Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
86
rated 0 times [  87] [ 1]  / answers: 1 / hits: 129930  / 14 Years ago, mon, december 13, 2010, 12:00:00

How can I check if two different date objects have the same date information(having same day, month, year ...)? I have tried "==", "===" and .equals but none seems to work.


More From » date

 Answers
54

You can use valueOf() or getTime():


a = new Date(1995,11,17);
b = new Date(1995,11,17);

a.getTime() === b.getTime() // prints true

[#94622] Friday, December 10, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brodyfrancisi

Total Points: 1
Total Questions: 102
Total Answers: 89

Location: Marshall Islands
Member since Mon, May 31, 2021
3 Years ago
brodyfrancisi questions
;