Timezone for Firebase.ServerValue.TIMESTAMP

It looks like when I use Firebase.ServerValue.TIMESTAMP at the moment, it uses PDT (I assume it will change to PST in the fall).

Is there a way to get this in UTC instead of PDT?

+6
source share
1 answer

Firebase timestamps are always saved as milliseconds from the era (midnight 1/1/1970 in UTC). This is the same as dates working in Javascript and many other languages. This is a temporary-agnostic way of representing time.

Generally speaking, the time zone only plays a role in how the time is displayed to the user, and not in how it is displayed under the hood. Firebase times are no different.

So, if you create a JS date object using the timestamp created by Firebase.ServerValue.TIMESTAMP, it will automatically have the same time zone as the machine on which it is displayed.

+25
source

Source: https://habr.com/ru/post/949396/


All Articles