In Cloud Spanner, Is RFC 3339 the only format for TIMESTAMP type?

22 views Asked by At

In Cloud Spanner, Is RFC 3339 the only format for TIMESTAMP type? Seems to be the case from the documentation

1

There are 1 answers

0
Naren Mehra On

The client-side format used for reading/writing TIMESTAMP values depends on what language you are using.

The GoogleSQL docs specify the canonical formats:

  • SQL Timestamp literals have a format which is close to RFC-3339, 'YYYY-MM-DDTHH:MM:SS.FZ' but allow either 'T' or space to separate date/time, optional leading zeros, and optional time zone suffix. However there are many SQL functions for converting timestamps to/from other representations, such as Unix timestamps in millis
  • For REST and RPC APIs (your first link is to the REST API), RFC-3339 is used with required time zone suffix.
  • For client libraries, the client library documentation for the language specifies the format required/returned by the API (eg for Java: the Timestamp class)