Skip to main content

isoformat

Converts a datetime.date or datetime.time object to its ISO 8601 string representation.

def isoformat(
o: datetime.date | datetime.time
) - > str

Converts a date or time object into an ISO 8601 formatted string. This function is useful for standardizing date and time representations for storage or transmission.

Parameters

NameTypeDescription
o`datetime.datedatetime.time`

Returns

TypeDescription
strThe ISO 8601 formatted string representation of the date or time object.