Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Time zone for Firebase.ServerValue.TIMESTAMP

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?

like image 793
grampelberg Avatar asked Jul 14 '13 07:07

grampelberg


1 Answers

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.

like image 187
Andrew Lee Avatar answered Oct 17 '22 02:10

Andrew Lee