DateTime
A date-time
value indicates a specific instance in time. In Deephaven, a date-time
is typically represented by one of two data types:
These data types are used by Deephaven tables to represent moments in time. They are also used in the Python API. Both will be covered in this reference guide.
Instant
A java.time.Instant
represents a single instantaneous point in time, given in the UTC
time zone. Printing an instance of an instant always ends in the letter Z
, which is shorthand for UTC
.
ZonedDateTime
A java.time.ZonedDateTime
represents a single instantaneous point in time, given in the specified time zone. Printing an instance of a zoned date-time always ends in the specified time zone. For instance, for the ET
(US Eastern Time) time zone, a ZonedDateTime
ends in [America/New_York]
.
Syntax
'YYYY-MM-DDThh:mm:ss.ffffff TZ'
YYYY
- the yearMM
- the monthDD
- the dayT
- the separator between the date and timehh
- the hour of the daymm
- the minute of the hourss
- the second of the minuteffffff
- the fraction of a secondTZ
- the time zone
Example
The following example creates a table containing date-times and then filters the table based upon a date-time defined in a query string.
firstTime = parseInstant("2021-07-04T08:00:00 ET")
secondTime = parseInstant("2021-09-06T12:30:00 ET")
thirdTime = parseInstant("2021-12-25T21:15:00 ET")
source = newTable(
instantCol("DateTimes", firstTime, secondTime, thirdTime)
)
result = source.where("DateTimes = '2021-09-06T12:30:00 ET'")
- source
- result