Skip to content
This repository was archived by the owner on May 7, 2023. It is now read-only.

Files

Latest commit

 

History

History
22 lines (17 loc) · 462 Bytes

from-iso-date.md

File metadata and controls

22 lines (17 loc) · 462 Bytes
title type tags cover dateModified
Date from ISO format
snippet
date
purple-leaves
2021-01-07 23:30:28 +0200

Converts a date from its ISO-8601 representation.

  • Use datetime.datetime.fromisoformat() to convert the given ISO-8601 date to a datetime.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