Time zone for Firebase.ServerValue.TIMESTAMP

前端 未结 1 759
[愿得一人]
[愿得一人] 2020-12-17 15:01

It appears that when I use Firebase.ServerValue.TIMESTAMP currently, it is using PDT (I assume that will be changing to PST in the fall).

Is there a way

相关标签:
1条回答
  • 2020-12-17 15:11

    Firebase timestamps are always stored as milliseconds since the epoch (midnight of 1/1/1970 in UTC). This is the same way that dates work in Javascript and many other languages. This is a timezone-agnostic way of representing time.

    Generally speaking, timezone only plays a role in how a time is displayed to a user, not in how it's represented under-the-hood. Firebase timestamps are no different.

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

    0 讨论(0)
提交回复
热议问题