Home > database >  How do I convert a Date to Firebase Timestamp
How do I convert a Date to Firebase Timestamp

Time:10-31

How can i convert below date to firebase timestamp format ??

Date

22-May-2005

CodePudding user response:

You can simply use the following line:

var myTimestamp = firebase.firestore.Timestamp.fromDate(new Date());

.fromDate is a static method from the static Timestamp class from Firebase.

Ref: Firebase Timestamp Doc

  • Related