Search code examples
firebasegoogle-cloud-platformgoogle-cloud-firestore

Why Does Firestore's FieldValue.serverTimestamp() Always End with "0000" in Nanoseconds?


Nanosecond Precision:

Does the nanoseconds part of FieldValue.serverTimestamp() always end with "0000"?

Does Firestore provide true nanosecond resolution for server timestamps?

Any insights would be greatly appreciated.

Thank you!


Solution

  • From the Firebase documentation on data types:

    Data type: Date and time
    Sort order: Chronological
    Description: When stored in Cloud Firestore, precise only to microseconds; any additional precision is rounded down.

    So Firestore stores timestamp with microsecond precision, even if the SDKs may expose them with a higher resolution.