Click here to Skip to main content
12,404,895 members (71,780 online)
Rate this:
 
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 0: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 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 20-Nov-12 6:54am
   
Ur IE version and ur textbox input plz
Rajeev prasad yadav 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 21 Nov 2012
Copyright © CodeProject, 1999-2016
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