to_timedelta
to_timedelta
converts a Java time duration to a datetime.timedelta
.
danger
Avoid deephaven.time
functions in query strings. Because deephaven.time
provides functions that convert between Python and Java types, every call crosses the Python-Java boundary, which slows performance. For more information, see:
Syntax
to_timedelta(dt: Union[None, Duration]) -> datetime.timedelta
Parameters
Parameter | Type | Description |
---|---|---|
dt | Union[None, Duration] | A Java Duration to convert to a |
Returns
Returns a datetime.timedelta
.
Examples
from deephaven.time import to_j_duration, to_timedelta
duration = to_j_duration("PT42M")
td = to_timedelta(duration)
print(td, type(td))