timedelta_to_isoformat#
- openstef_core.utils.timedelta_to_isoformat(td: timedelta) str[source]#
Convert timedelta to ISO 8601 string format.
- Parameters:
td (timedelta) – The timedelta object to convert.
- Returns:
ISO 8601 duration string representation (e.g., ‘PT15M’ for 15 minutes).
- Return type:
str
Example
Convert a 15-minute interval:
>>> from datetime import timedelta >>> td = timedelta(minutes=15) >>> timedelta_to_isoformat(td) 'PT15M'
- Parameters:
td (
timedelta)- Return type:
str