Converts a date from its ISO-8601 representation.
- Use
datetime.datetime.fromisoformat()
to convert the given ISO-8601 date to adatetime.datetime
object.
代码实现
from datetime import datetime
def from_iso_date(d):
return datetime.fromisoformat(d)
使用样例
from_iso_date('2020-10-28T12:30:59.000000') # 2020-10-28 12:30:59