Timestamp.fromDate constructor
Timestamp.fromDate(
- DateTime date
Creates a new timestamp from the given date.
final documentRef = firestore.doc('col/doc');
final date = Date.parse('01 Jan 2000 00:00:00 GMT');
documentRef.set({ 'startTime': Timestamp.fromDate(date) });
date
: The date to initialize theTimestamp
from.
Returns a new Timestamp representing the same point in time as the given date.
Implementation
factory Timestamp.fromDate(DateTime date) {
return Timestamp.fromMicros(date.microsecondsSinceEpoch);
}