How to get string and Date object from TIMESTAMP in Firebase Functions?

Hamoonist

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?

Jürgen Brandstetter

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]

編集
0

コメントを追加

0

関連記事

分類Dev

Get Date from String Containing Timestamp

分類Dev

How to write date / timestamp string to Date timestamp column in Oracle DB?

分類Dev

string from input: date convert to timestamp

分類Dev

Get offset from datetime string and apply to a new date object

分類Dev

Firebase Cloud Functions: how to get data from `change` and `context`?

分類Dev

ng-bootstrap how get string or Date format no object

分類Dev

Get UTC timestamp from PySpark string column

分類Dev

How to get a formatted date and time string from `now`?

分類Dev

How can i get python function object from a string

分類Dev

Get calculated date from moment object react

分類Dev

How to get UTC Date object in NodeJS?

分類Dev

JS: How get the object with the most recently date

分類Dev

Get Download URL from file uploaded with Cloud Functions for Firebase

分類Dev

Get date, month and year value from Date string

分類Dev

How to get ParseObject's createdAt date as String?

分類Dev

Firebase cloud functions: How to get the reference to the document with wildcard notation?

分類Dev

How to fix “Cannot GET” Error on Firebase Cloud Functions

分類Dev

Firebase Firestore Returning Timestamp as Empty Object

分類Dev

How to get data from a string

分類Dev

How to fetch date from string format

分類Dev

get Array-Object-String thing from the given Object

分類Dev

How to invoke other Cloud Firebase Functions from a Cloud Function

分類Dev

How to get month name from date in Presto

分類Dev

How to get expiration date from a gpg key

分類Dev

how to get current date from server

分類Dev

How to get a proper date from a text?

分類Dev

PHP date_format(): How to format date from string value

分類Dev

How to obtain a local timezone Date from a date string in javascript?

分類Dev

How to get current user address from firebase

Related 関連記事

  1. 1

    Get Date from String Containing Timestamp

  2. 2

    How to write date / timestamp string to Date timestamp column in Oracle DB?

  3. 3

    string from input: date convert to timestamp

  4. 4

    Get offset from datetime string and apply to a new date object

  5. 5

    Firebase Cloud Functions: how to get data from `change` and `context`?

  6. 6

    ng-bootstrap how get string or Date format no object

  7. 7

    Get UTC timestamp from PySpark string column

  8. 8

    How to get a formatted date and time string from `now`?

  9. 9

    How can i get python function object from a string

  10. 10

    Get calculated date from moment object react

  11. 11

    How to get UTC Date object in NodeJS?

  12. 12

    JS: How get the object with the most recently date

  13. 13

    Get Download URL from file uploaded with Cloud Functions for Firebase

  14. 14

    Get date, month and year value from Date string

  15. 15

    How to get ParseObject's createdAt date as String?

  16. 16

    Firebase cloud functions: How to get the reference to the document with wildcard notation?

  17. 17

    How to fix “Cannot GET” Error on Firebase Cloud Functions

  18. 18

    Firebase Firestore Returning Timestamp as Empty Object

  19. 19

    How to get data from a string

  20. 20

    How to fetch date from string format

  21. 21

    get Array-Object-String thing from the given Object

  22. 22

    How to invoke other Cloud Firebase Functions from a Cloud Function

  23. 23

    How to get month name from date in Presto

  24. 24

    How to get expiration date from a gpg key

  25. 25

    how to get current date from server

  26. 26

    How to get a proper date from a text?

  27. 27

    PHP date_format(): How to format date from string value

  28. 28

    How to obtain a local timezone Date from a date string in javascript?

  29. 29

    How to get current user address from firebase

ホットタグ

アーカイブ