datetime part 1

python


import datetime

now = datetime.datetime.now()
print(now)
print(now.isoformat())
print(now.strftime('%d/%m/%Y-%H:%M:%S:%f'))
print('##########')

today = datetime.date.today()
print(today)
print(today.isoformat())
print(today.strftime('%d/%m/%y'))
print('##########')

t = datetime.time(hour=1, minute=15, second=30, microsecond=100)
print(t)
print(t.isoformat())
print(t.strftime('%H:%M:%S:%f'))

Execution result


2020-02-26 10:56:54.691417
2020-02-26T10:56:54.691417
26/02/2020-10:56:54:691417
##########
2020-02-26
2020-02-26
26/02/20
##########
01:15:30.000100
01:15:30.000100
01:15:30:000100

Recommended Posts

datetime part 1
numpy part 1
argparse part 1
numpy part 2
Queuing theory part 4
neo4j sandbox part 12
QGIS + Python Part 2
neo4j sandbox part 5
datetime module usage
Django begins part 1
Manim's method part 23
Report_Deep Learning (Part 2)
Report_Deep Learning (Part 1)
Report_Deep Learning (Part 1)
QGIS + Python Part 1
GMT installation part 2.
GMT installation part 1.
Django begins part 4
Report_Deep Learning (Part 2)
neo4j sandbox part 13
neo4j sandbox part 15
Queuing theory part 3
Python: Scraping Part 1
neo4j sandbox part 16
neo4j sandbox part 11
Python3 Beginning Part 1
Python: Scraping Part 2
pandas series part 1