Hey i want to program of check the date with a fix date and identify it is before or after that fix date. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

13th Dec 2016, 1:30 PM
Manik Kore
Manik Kore - avatar
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
13th Dec 2016, 4:37 PM
seamiki
seamiki - avatar
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
17th Jan 2017, 2:44 PM
Douwe Huysmans
Douwe Huysmans - avatar