1

If I log events offline and then send them online in a bulk to Firebase then, will the event date be the same as the date of sending or logging?

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
Amit
  • 21
  • 2

1 Answers1

1

Neither Cloud Firestore nor Firebase Realtime Database does not have the date and time stored in the metadata. If you need this feature, you should add a timestamp property for each document/node separately. That actually represents a FieldValue.serverTimestamp() in case of Cloud Firestore and a ServerValue.TIMESTAMP in case of Firebase Realtime Database.

Please also bear in mind that both types of timestamps are generated on the server. In the case of Cloud Firestore it's a Date object, and in case of Firebase Realtime Database is a long value which represents the time since the Unix epoch, in milliseconds.

If you have this kind of property present in your database and you set/modify it once an object is added/changed, then the date and time of that property is the date and time when the device comes back online since the timestamp is generated entirely by Firebase servers. And to answer your question:

will the event date be the same as the date of sending or logging?

It will be the time of sending and not logging.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193