javascript - compare dates in different formats
Without using a 3rd party library, you can create new Date
objects using both those formats, retrieve the number of milliseconds (since midnight Jan 1, 1970) using getTime()
and then simply use >
:
new Date("2013/08/26").getTime() > new Date(1381308375118).getTime()
I strongly recommend using datejs library.
Thus this can be written in one single line:
Date.today().isAfter(Date.parse('2013/08/26'))