python:handling_dates

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
python:handling_dates [2023/03/20 17:34] – created mguptonpython:handling_dates [2023/03/20 18:18] (current) mgupton
Line 1: Line 1:
 ====== Handling Dates ====== ====== Handling Dates ======
-Convert //datetimes// to and from strings in [[wp>ISO 8601]] format+Convert //datetime// values to and from strings in [[wp>ISO 8601]] format
 <code python> <code python>
 from datetime import datetime from datetime import datetime
Line 7: Line 7:
 dt = datetime.now() dt = datetime.now()
  
-print(dt) +print(type(dt)
-print(dt.isoformat())+print(type(dt.isoformat()))
  
 print(type(dateutil.parser.parse('2023-03-20T15:35:30Z'))) print(type(dateutil.parser.parse('2023-03-20T15:35:30Z')))
 </code> </code>
  
  • python/handling_dates.1679333680.txt.gz
  • Last modified: 2023/03/20 17:34
  • by mgupton