Timestamp.fromMillis constructor
Timestamp.fromMillis(
- int milliseconds
Creates a new timestamp from the given number of milliseconds.
final documentRef = firestore.doc('col/doc');
documentRef.set({ 'startTime': Timestamp.fromMillis(42) });
milliseconds
: Number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.
Returns a new Timestamp representing the same point in time as the given number of milliseconds.
Implementation
factory Timestamp.fromMillis(int milliseconds) {
final seconds = (milliseconds / 1000).floor();
final nanos = (milliseconds - seconds * 1000) * _msToNanos;
return Timestamp._(seconds: seconds, nanoseconds: nanos);
}