Skip to main content
Version: Python

DateTime

Date-time values indicate a specific instant in time and can be specified in Deephaven query strings by using single quotes '.

Syntax

'YYYY-MM-DDThh:mm:ss.ffffff TZ'

  • YYYY - the year
  • MM - the month
  • DD - the day
  • T - the separator between the date and time
  • hh - the hour of the day
  • mm - the minute of the hour
  • ss - the second of the minute
  • ffffff - the fraction of a second
  • TZ - 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.

from deephaven.time import to_datetime
from deephaven import new_table
from deephaven.column import datetime_col

firstTime = to_datetime("2021-07-04T08:00:00 NY")
secondTime = to_datetime("2021-09-06T12:30:00 NY")
thirdTime = to_datetime("2021-12-25T21:15:00 NY")

source = new_table([
datetime_col("DateTimes", [firstTime, secondTime, thirdTime])
])

result = source.where(filters=["DateTimes = '2021-09-06T12:30:00 NY'"])