Saturday 2 June 2012

Date difference javascript

I want to compare the date selected from datepicker and the current date. Though everything seemed right, i didn't get the correct output. The reason is the date from datepicker contains time as 00:00:00 where as the currentdate contains the proper time. Set the time as zero using setHours().
date1 = new Date();
date1.setHours(0,0,0,0);
Reference: 
http://stackoverflow.com/questions/2698725/
comparing-date-part-only-without-comparing-time-in-javascript 

No comments:

Post a Comment