Skip to main content

timestamp

timestamp(text: String) : Timestamp

Obtains a Timestamp from a String that represents a date and time in UTC according to the ISO 8601 standard. For example, timestamp("2000-01-01T00:00:00Z") returns a Timestamp that represents midnight UTC on January 1, 2000.

This function will raise an error in the following cases:

  • if the string is absent;
  • if the string deviates from the ISO 8601 standard for a date and time in UTC; and
  • if the string represents a date and time that time includes a nonzero amount of nanoseconds, such as the string "2000-01-01T00:00:00.123Z".

timestamp(duration: Duration) : Timestamp

Obtains a Timestamp from a Duration by starting with the timestamp for the epoch, which is equal to timestamp("1970-01-01T00:00:00Z"), and then adding the duration to it.

This function will raise an error in the following cases:

  • if the duration is absent;
  • if the duration is less than -31557014167219200 seconds; and
  • if the duration is more than 31556889864403199 seconds.

See also

Functions

Types