Reputation: 31
I picked a "date" form datePicker and wanted to save that date (type as DateTime) to Firestore in Timestamp type. I used Firestore.fromDate(date) but it stores data in Firestore as a map(nanoseconds, seconds).
Upvotes: 0
Views: 1106
Reputation: 14276
Use the Firebase Timestamp
class as:
Timestamp.fromMicrosecondsSinceEpoch(myDateTime.microsecondsSinceEpoch)
There are many other constructors, take a look at the docs.
Upvotes: 1