Skip to content Skip to sidebar Skip to footer

Convert Local Timezone Timestamp To Utc Timestamp

My server returns date data as local timezone timestamps. On the client-side, I want to display those dates as local date strings. If I do the following, I got the wrong date ('6/3

Solution 1:

Isn't that right already? Timestamps are always in UTC.

You're seeing 30th June and not 1st of July because when that event happened, in the local time zone, it was still 30th of June. For example, for me it is showing as 1st of July in IST.

enter image description here

Also, this timestamp represents an event which occurred at 1st July 2014 at 00:00:00 GMT exactly. India is GMT+05:30, as you can see in the screenshot - so if the local timezone, even if it is GMT minus one minute, it would still be 30th of June there.

Post a Comment for "Convert Local Timezone Timestamp To Utc Timestamp"