Timestamps are stored in Riak TS as epoch milliseconds, but TS also supports ISO 8601 string representations. This document will present the basics, but we highly recommend reading Learn About Timestamps for all the details. This is a time series database, after all.
ISO 8601 support is useful for casual interactions via riak shell, but we do NOT recommend using ISO 8601 in production applications. Instead, use the TS-supported client libraries to pass timestamps as integers for better performance and correctness.
ISO 8601 Guidelines
Date/time strings in ISO 8601 are relatively straightforward to read
and write. Some examples, all of which represent the same timestamp
When using ISO 8601 strings for INSERT or SELECT statements, be sure to use single quotes around the string.
Strings that do not include seconds are referred to by the standard as reduced accuracy representations. A couple examples:
Using reduced accuracy for values in an
INSERT will result in a
millisecond UTC time that corresponds to the start of the time period
2016-08 will map to midnight on August 1st 2016, for
See Learn About Timestamps for the implications of using reduced accuracy in queries.
Fractional times are particularly relevant given the millisecond accuracy in Riak TS timestamps.
2016-08-01 14:05:51.425Z would be converted to the Riak
TS millisecond timestamp
It is possible to define a cluster-wide default time zone, expressed as an offset from GMT.
Its impact is limited to interpreting strings used for
INSERT that do not include a time zone specification.
$ riak-admin timezone not configured $ riak-admin timezone "-05:00" Success, timezone is now configured to '-05:00' $ riak-admin timezone -05:00
It is only necessary to do this on one of your cluster members.
In the absence of such a configuration, the default time zone will be GMT.
IMPORTANT: Daylight Saving Time
There is a caveat when setting the default time zone. Defining a default time zone as a GMT offset means that when Daylight Saving Time begins or ends, the default time zone must be reconfigured for times to be translated correctly.
You can schedule a cron job to adjust the time zone, but be aware that different implementations of cron handle DST transitions differently.
For more information on time zones, see Learn About Timestamps.