How To Create Utc Date In Js?
When i try to create the date in UTC like new Date(Date.UTC(2013, 10, 7, 10, 3, 19)) i still receive Thu Nov 07 2013 12:03:19 GMT+0200 (FLE Standard Time) where it adds +2 hours. H
Solution 1:
The date you created is actually 2013-11-07 10:03:19 UTC, but when you print it, it will print the date in your local timezone. To extract the UTC date, you could try using toUTCString(), like so:
Date(Date.UTC(2013, 10, 7, 10, 3, 19)).toUTCString() //"Thu, 07 Nov 2013 10:03:19 GMT"
Solution 2:
Please remove Date.UTC:
newDate(Date.UTC(2013, 10, 7, 10, 3, 19))
ThuNov07201315:33:19GMT+0530 (IST)
newDate(2013, 10, 7, 10, 3, 19)
ThuNov07201310:03:19GMT+0530 (IST)
Post a Comment for "How To Create Utc Date In Js?"