Skip to content Skip to sidebar Skip to footer

How To Save Previous Timestamp To Firebase Firestore

I want to migrate the older data from different system to firestore. below command saves current timestamp firebase.firestore.FieldValue.serverTimestamp() I want to store older va

Solution 1:

firebase.firestore.FieldValue.serverTimestamp() is a marker value you can use in your code to write the current server-side timestamp into a date field. If you want to store another value in a date field, you can specify the value when writing.

From the Firebase documentation on adding data:

db.collection("data").doc("one").set({
    dateField: newDate("December 10, 1815"),
}).then(function() {
    console.log("Document successfully written!");
});

Post a Comment for "How To Save Previous Timestamp To Firebase Firestore"