Firebase.ServerValue.TIMESTAMP的时区 [英] Time zone for Firebase.ServerValue.TIMESTAMP

查看:430
本文介绍了Firebase.ServerValue.TIMESTAMP的时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来,当我使用 Firebase.ServerValue.TIMESTAMP 目前,它正在使用PDT(我认为将在秋季改为PST)。



有没有办法以UTC取代PDT?

时代(1970年1月1日午夜UTC)开始,Firebase时间戳总是以毫秒为单位存储。日期在JavaScript和许多其他语言中工作的方式也是如此。这是一个表示时间的时区不可知的方式。一般来说,时区只在时间如何显示给用户时发挥作用,而不是在如何表示-THE罩。因此,如果您使用由Firebase.ServerValue.TIMESTAMP创建的时间戳记构造JS日期对象,它将自动具有与该时间戳相同的时区。因此,Firebase时间戳也不例外。机器正在显示。


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 to get this in UTC instead of PDT?

解决方案

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.

这篇关于Firebase.ServerValue.TIMESTAMP的时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆