python:handling_dates

This is an old revision of the document!


Handling Dates

Convert datetimes to and from strings in ISO 8601 format

from datetime import datetime
import dateutil.parser
 
dt = datetime.now()
 
print(type(dt))
print(type(dt.isoformat()))
 
print(type(dateutil.parser.parse('2023-03-20T15:35:30Z')))
  • python/handling_dates.1679335120.txt.gz
  • Last modified: 2023/03/20 17:58
  • by mgupton