Files
30-seconds-of-code/snippets/from_iso_date.md
Isabelle Viktoria Maciohsek 0ab4b3dbc5 Update snippet descriptions
2020-11-02 19:27:53 +02:00

20 lines
390 B
Markdown

---
title: from_iso_date
tags: date,intermediate
---
Converts a date from its ISO-8601 represenation.
- Use `datetime.datetime.fromisoformat()` to convert the given ISO-8601 date to a `datetime.datetime` object.
```py
from datetime import datetime
def from_iso_date(d):
return datetime.fromisoformat(d)
```
```py
from_iso_date('2020-10-28T12:30:59.000000') # 2020-10-28 12:30:59
```