flowbber.utils.iso8601
¶Utilities to handle ISO 8601 formatted dates.
iso8601_to_datetime()
:
Converts a date of the format YYYY:MM:DDTHH:MM:SS (ISO 8601) todatetime_to_iso8601()
:
Converts a datetime object to a date string of the formatflowbber.utils.iso8601.
iso8601_to_datetime
(date_string)¶Converts a date of the format YYYY:MM:DDTHH:MM:SS (ISO 8601) to a datetime object.
This function is somewhat analogous to:
from datetime import datetime
datetime.fromisoformat('2019-08-05T14:38:13')
But since datetime.fromisoformat()
was added only in
Python 3.7 this function is left for backward compatibility.
flowbber.utils.iso8601.
datetime_to_iso8601
(date)¶Converts a datetime object to a date string of the format YYYY:MM:DDTHH:MM:SS (ISO 8601).
This function is analogous to:
from datetime import datetime
datetime.now().replace(microsecond=0).isoformat()
DateTimeJSONEncoder
:
Custom JSON enconder that converts any datetime object to a ISO 8601flowbber.utils.iso8601.
DateTimeJSONEncoder
(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)¶Custom JSON enconder that converts any datetime object to a ISO 8601 date string.
Inheritance