Parses an ISO-8601-formatted string into a datetime object. Args: iso_8601_string: The ISO-8601-formatted string to parse (e.g., '2021-02-10T085735Z'). Returns: A datetime object corresponding to the input string in UTC timezone.
(iso_8601_string)
| 16 | |
| 17 | |
| 18 | def parse(iso_8601_string): |
| 19 | """Parses an ISO-8601-formatted string into a datetime object. |
| 20 | |
| 21 | Args: |
| 22 | iso_8601_string: The ISO-8601-formatted string to parse (e.g., |
| 23 | '2021-02-10T085735Z'). |
| 24 | |
| 25 | Returns: |
| 26 | A datetime object corresponding to the input string in UTC timezone. |
| 27 | """ |
| 28 | return datetime.datetime.strptime( |
| 29 | iso_8601_string, _ISO_8601_FORMAT).replace(tzinfo=datetime.timezone.utc) |
nothing calls this directly
no outgoing calls
no test coverage detected