Timestamp.now constructor

Timestamp.now()

Creates a new timestamp with the current date, with millisecond precision.

The time comes from this device's clock. To store the time of the server instead, write FieldValue.serverTimestamp().

Implementation

factory Timestamp.now() {
  return Timestamp.fromMillisecondsSinceEpoch(
    DateTime.now().millisecondsSinceEpoch,
  );
}