Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Javascript
Hi all,
 
please help me....
 
this is my javascript function
 
function doCompareDate() {
var CustOrderDt = document.getElementById("TxtDeliveryDate"").value;
var DelvDt = document.getElementById("Txtcustorderdt").value
var dtCustOrder = new Date(CustOrderDt);
var dtDelvDt = new Date(DelvDt);
 
if (dtCustOrder > dtDelvDt) {
alert("Customer Order date can not be greater than delivery date");
return false;
}
}
 
this function do well in google crome,
but in Internet Explorer (IE) does not work..
 
please help me to do this also in Internet Explorer.
Posted 20-Nov-12 1:19am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hello Rajeev try this,
function doCompareDate() {
var CustOrderDt = document.getElementById("TxtDeliveryDate"").value;
var DelvDt = document.getElementById("Txtcustorderdt").value
var dtCustOrder = new Date(CustOrderDt).getTime();
var dtDelvDt = new Date(DelvDt).getTime();
 
if (dtCustOrder > dtDelvDt) {
alert("Customer Order date can not be greater than delivery date");
return false;
}
}
 
or
function dateCheck() {
 
    var fDate,lDate;
    fDate = Date.parse(document.getElementById("fDate").value);
    lDate = Date.parse(document.getElementById("lDate").value);
 
    if(lDate >= fDate) {
        alert("true");
        return true;
    }
    alert("false");
    return false;
}
  Permalink  
v2
Comments
Rajeev prasad yadav at 20-Nov-12 6:42am
   
Thanks Karthik to reply me...
but still have same problem, This one is also not working in IE.
Karthik_J, Coimbatore at 20-Nov-12 6:54am
   
Ur IE version and ur textbox input plz
Rajeev prasad yadav at 20-Nov-12 23:25pm
   
Karthik,
 
still not working...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

It's working well try this,
http://jsfiddle.net/4F7pH/
 
you may not follow the standard of javascript date class constructor.
 
new Date() // current date and time
new Date(milliseconds) //milliseconds since 1970/01/01
new Date(dateString)
new Date(year, month, day, hours, minutes, seconds, milliseconds)
 
var today = new Date()
var d1 = new Date("October 13, 1975 11:13:00")
var d2 = new Date(79,5,24)
var d3 = new Date(79,5,24,11,33,0)
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Dnyaneshwar@Pune 719
1 Sergey Alexandrovich Kryukov 305
2 Peter Leow 280
3 TheRealSteveJudge 248
4 CPallini 195
0 Sergey Alexandrovich Kryukov 8,963
1 OriginalGriff 6,766
2 Peter Leow 4,262
3 Zoltán Zörgő 3,769
4 Richard MacCutchan 2,588


Advertise | Privacy | Mobile
Web02 | 2.8.150123.1 | Last Updated 21 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100