Skip to main content
Version: Python

lower_bin

lower_bin returns a DateTime value, which is at the starting (lower) end of a time range defined by the interval nanoseconds. For example, a 5*MINUTE intervalNanos value would return the DateTime value for the start of the five-minute window that contains the input date-time.

Syntax

lower_bin(dt, interval, offset=0)

Parameters

ParameterTypeDescription
dtDateTime

The DateTime for which to evaluate the start of the containing window.

intervalint

The size of the window in nanoseconds.

offsetint

The window start offset in nanoseconds. For example, a value of MINUTE would offset all windows by one minute. Default is 0.

Returns

Returns the DateTime value at the start of the bin.

Examples

from deephaven.time import to_datetime, lower_bin

datetime = to_datetime("2022-01-01T00:35:00 NY")
nanos_bin = 900000000000
nanos_offset = 120000000000

result0 = lower_bin(datetime, nanos_bin)
print(result0)

result1 = lower_bin(datetime, nanos_bin, offset=nanos_offset)
print(result1)