Skip to main content
Version: Python

to_j_time_zone

to_j_time_zone converts a time zone value into a Java TimeZone.

info

In query strings, users should choose the built-in function parseTimeZone instead of to_j_time_zone. For more information, see:

Syntax

to_j_time_zone(tz: Union[None, TimeZone, str, datetime.tzinfo, datetime.datetime, pandas.Timestamp]) -> TimeZone

Parameters

ParameterTypeDescription
tzUnion[None, TimeZone, str, datetime.tzinfo, datetime.datetime, pandas.Timestamp]

The time zone value to convert to a Java TimeZone.

Returns

Returns a TimeZone.

Examples

from deephaven.time import to_j_time_zone
import datetime
import pandas as pd

dt_tz = datetime.timezone(datetime.timedelta(0, 0, 0, 0, 0, 3), "Tzone")
pd_timestamp = pd.Timestamp(1513393355, unit="s", tz="US/Pacific")
tz_str = "UTC"

tz_from_dt_tz = to_j_time_zone(dt_tz)
tz_from_pd_timestamp = to_j_time_zone(pd_timestamp)
tz_from_str = to_j_time_zone(tz_str)

print(tz_from_dt_tz)
print(tz_from_pd_timestamp)
print(tz_from_str)