How can I compare a UTC timestamp date to the current date in Javascript?

时间:2015-05-24 20:25:52

标签: javascript date time momentjs utc

I have a UTC timestamp that I need to compare with the current date. The current date is the date.. not the hour or the second. Just the date

So I need to compare a UTC stamp to that in Javascript. Can anybody help me out?

1 个答案:

答案 0 :(得分:0)

The Date type in javascript has the getTime() method witch returns the milliseconds since 1/1/1970. So is you get the time from both dates you can compare them.

var dDate = new Date();
var iMilSecs = dDate.getTime();
相关问题