Overview
The ability to filter data based on temporal data is fundamental for users working with time-series data, and Deephaven offers many methods and utilities to do so. Before discussing those methods, we need to understand the specific syntax used for temporal units.
Three distinctive temporal units are available in the query language. The syntax used for each follows.
DateTime
A DateTime is a specific moment in time, including units as large as the year and as small as the nanosecond. The format of a DateTime follows:
yyyy-mm-ddThh:mm:ss.millis/micros/nanos TZ
The T
between dd
and hh
is a divider, and TZ
represents the time zone.
Examples
|
October 25, 2019 at 4:33 pm in UTC |
|
May 21, 2017 at 2:45:52.517863000 pm in New York |
|
March 8, 2018 at 9:12 am in Tokyo |
Using the full DateTime string allows for very fine granularity and specificity in selecting values. However, seconds and smaller values are optional and do not need to be specified in the Deephaven Query language.
Period
A period is a duration of time and can be represented with the following patterns: -#Y#M#W#DT#H#M#S
. The negative sign and partial periods are optional. For example, if you wanted to compute the DBDateTime 1 day and 1 hour from another DBDateTime, you could use time+'1dT1h'
.
Durations/Times (part of a DBDateTime)
Durations/Times can be represented with the following patterns: -hh:mm:ss.millis/micros/nanos
. The negative is optional. This gets converted into a Long representing the nanoseconds since January 1, 1970 UTC. For example, '01:02:03.456'
is 1 hour, 2 minutes, 3 seconds, and 456 milliseconds. Durations/Times can be added to DBDateTimes.
Last Updated: 16 February 2021 18:07 -04:00 UTC Deephaven v.1.20200928 (See other versions)
Deephaven Documentation Copyright 2016-2020 Deephaven Data Labs, LLC All Rights Reserved