Skip to main content
Version: Python

datetime_at_midnight

datetime_at_midnight returns a DateTime for the requested DateTime at midnight in the specified time zone.

Syntax

datetime_at_midnight(dt, tz)

Parameters

ParameterTypeDescription
dtDateTime

The DateTime to convert to midnight

tzTimeZone

TimeZone for which the new value at midnight should be calculated

Returns

Returns the DateTime at midnight in the time zone

Examples

from deephaven.time import to_datetime, datetime_at_midnight, TimeZone

datetime = to_datetime("2022-01-01T00:00:00 NY")

datetime_midnight = datetime_at_midnight(datetime, TimeZone.NY)
print(datetime_midnight)