deepakmittal6_b
12-21-2005, 04:53 AM
How to compare two dates in Java script.
I need to find the difference between two dates.
Although i have found a method on this site but I am not sure about this whether it is right or not.
Because this logic fails for some values.
sysdate= Date.parse(date2,month2,year2);
entereddate= Date.parse(date1,month1,year1);
defauldate=Date.parse(defaultdate);
alert(sysdate);
alert(entereddate);
alert(defauldate);
alert((sysdate-entereddate)/(24*60*60*1000));
alert((entereddate-defauldate)/(24*60*60*1000));
Please reply back in anyone finds the answer.
Regards,
Deepak
I need to find the difference between two dates.
Although i have found a method on this site but I am not sure about this whether it is right or not.
Because this logic fails for some values.
sysdate= Date.parse(date2,month2,year2);
entereddate= Date.parse(date1,month1,year1);
defauldate=Date.parse(defaultdate);
alert(sysdate);
alert(entereddate);
alert(defauldate);
alert((sysdate-entereddate)/(24*60*60*1000));
alert((entereddate-defauldate)/(24*60*60*1000));
Please reply back in anyone finds the answer.
Regards,
Deepak