delta_resolution
Round a :class:~datetime.datetime to the resolution of timedelta.
If the :class:`~datetime.timedelta` is in days, the
:class:`~datetime.datetime` will be rounded to the nearest days,
if the :class:`~datetime.timedelta` is in hours the
:class:`~datetime.datetime` will be rounded to the nearest hour,
and so on until seconds, which will just return the original
:class:`~datetime.datetime`.
def delta_resolution(
dt: datetime,
delta: timedelta
) - > datetime
Round a :class:~datetime.datetime to the resolution of timedelta.
Parameters
| Name | Type | Description |
|---|---|---|
| dt | datetime | The datetime object to be rounded or truncated based on the provided delta. |
| delta | timedelta | The time interval used to determine the rounding resolution (e.g., days, hours, or minutes). |
Returns
| Type | Description |
|---|---|
datetime | A new datetime object truncated to the specified resolution, or the original datetime if the resolution is in seconds. |