Skip to main content


This function parses the argument using the specified format if specified.


TIMESTAMP ( arg [ , <format_modifier>,  format] )  

<format_modifier> ::=
| "ZONE"


arg A value to be converted to a timestamp. Valid arguments are numeric, date/time values, and strings. If a format is specified arg must be of type STRING.

Specifies how the format argument should be interpreted.

An optional string argument to specify how the arg should be interpreted.

Return Value

A time to nanosecond precision of TIMESTAMP data type.


  • When the arg is a numeric it is interpreted as the number of nanoseconds since January 1, 1970 UTC.
  • The TIMESTAMP datatype has a smaller date range than the DATETIME datatype and should be used as an alternative if more percision is needed.
  • If a string is provided and "FORMAT" is not specified, the default format is "2006-01-02 15:04:05.000000000"
  • If "ZONE" is specified, the format must be "UTC" or a location name corresponding to a file in the IANA Time Zone database, such as "America/Los_Angeles".


This example interprets the provided string using the format provided, outputting its full representation.

SELECT TIMESTAMP("2021-05-12 08:06:25", "FORMAT", "2006-01-02 15:04:05") AS formatted;

For a list of golang time formats see the time package.


2021-05-12 08:06:25.000000000