to_j_zdt
to_j_zdt
converts a date-time value to a Java ZonedDateTime
.
info
In query strings, users should choose the built-in function parseZonedDateTime
instead of to_j_zdt
. For more information, see:
Syntax
to_j_zdt(dt: Union[None, ZonedDateTime, str, datetime.datetime, numpy.datetime64, pandas.Timestamp]) -> ZonedDateTime
Parameters
Parameter | Type | Description |
---|---|---|
dt | Union[None, ZonedDateTime, str, datetime.datetime, numpy.datetime64, pandas.Timestamp] | A date-time value to convert to a Java ZonedDateTime strings should be formatted according to the ISO-8601 standard, which is |
Returns
Returns a ZonedDateTime
representation of the date-time string.
Examples
from deephaven.time import to_j_zdt
import numpy as np
import pandas as pd
import pytz
import datetime
date_string = "2024-08-01T12:00:00 UTC"
cst = pytz.timezone("US/Central")
z_datetime = cst.localize(datetime.datetime.now())
z_timestamp = pd.Timestamp("2024-08-01 12:00:00", tz="America/New_York")
zdt_from_dt = to_j_zdt(z_datetime)
zdt_from_timestamp = to_j_zdt(z_timestamp)
zdt_from_str = to_j_zdt(date_string)
print(zdt_from_dt)
print(zdt_from_timestamp)
print(zdt_from_str)