0
Hey i want to program of check the date with a fix date and identify it is before or after that fix date.
suppose fix date is 25 march 2016 and we enter 20 January 2016 so it have to display the date is before fix date.using java script in html
2 Answers
+ 1
you can compare the number of milliseconds elapsed from 1Jan 1970 to your fix date and the number of millisecond elapsed between 1 Jan 1970 and your chek date.
if the difference is negative the check date comes before the fix date.
else the check date comes after the fix date.
You need JavaScript, below is a link to the date object reference page:
http://www.w3schools.com/jsref/jsref_obj_date.asp
0
If (yearA == yearB) {
If( monthA == monthB) {
return dayA < dayB;
}
else { return monthA < monthB}
}
else { return yearA < yearB}
You will need to convert the month names to integers ofcourse