I got timestamp in Firebase Functions with
admin.database.ServerValue.TIMESTAMP
However, when I pass it as a string, it becomes [object object] I saved it in Firebase Realtime database and when I checked it from console I saw 1505298866520 which I think it is milliseconds since UNIX epoch. Do you know how can I get string from it or how can I do time calculations with it? Or what type of object TIMESTAMP returns?
The firebase.database.ServerValue.TIMESTAMP
or admin.database.ServerValue.TIMESTAMP
hold the following object {.sv: "timestamp"}
. This is a specific firebase-database object. That tells the server it should use the server's UNIX-time when an object is added to the database.
That is the reason you can not use it as a date
object in javascript.
If you use admin.database.ServerValue.TIMESTAMP
on the server via cloud functions
it should represent the same as new Date().getTime()
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加