parse_datetime
Parse a string and return a datetime.datetime.
This function supports time zone offsets. When the input contains one, the output uses a timezone with a fixed offset from UTC.
Raise ValueError if the input is well formatted but not a valid datetime. Return None if the input isn't well formatted.
def parse_datetime(
value: str
) - > datetime.datetime | None
Parse a string and return a datetime.datetime. This function supports time zone offsets. When the input contains one, the output uses a timezone with a fixed offset from UTC. Raise ValueError if the input is well formatted but not a valid datetime. Return None if the input isn't well formatted.
Parameters
| Name | Type | Description |
|---|---|---|
| value | str | The date-time string to be parsed, typically in ISO 8601 format or a similar supported pattern. |
Returns
| Type | Description |
|---|---|
| `datetime.datetime | None` |