>>> from datetime import datetime
>>> datetime.now().strftime('%Y%m%d-%H%M%S')
'20191219-140750'
https://docs.python.org/ja/3/library/datetime.html#strftime-and-strptime-format-codes
>>> datetime.now().isoformat()
'2019-12-19T14:11:53.346885'
Recommended Posts