align_datetime#
- openstef_core.utils.align_datetime(timestamp: datetime, interval: timedelta, mode: Literal['ceil', 'floor'] = 'ceil') datetime[source]#
Align timestamp using modulo approach.
- Parameters:
timestamp (
datetime) – The datetime to align.interval (
timedelta) – Time interval to align to.mode (
Literal['ceil','floor']) – Alignment direction - “ceil” for next interval, “floor” for previous.timestamp
interval
mode
- Returns:
Aligned datetime matching the specified interval boundary.
- Raises:
ValueError – If mode is not “ceil” or “floor”.
- Return type:
datetime