parse_isodatetime¶
- safir.datetime.parse_isodatetime(time_string)¶
Parse a string in a standard ISO date format.
- Parameters:
time_string (
str) – Date and time formatted as an ISO 8601 date and time usingZas the time zone. This is the same format produced byisodatetimeand is compatible with Kubernetes and the IVOA UWS standard.- Returns:
The corresponding
datetime.datetime.- Return type:
- Raises:
ValueError – The provided
time_stringis not in the correct format.
Notes
When parsing input for a model, use
safir.pydantic.normalize_isodatetimeinstead of this function. Using a model will be the normal case; this function is primarily useful in tests or for the special parsing cases required by the IVOA UWS standard.