1from datetime import datetime
2
3date = datetime.now()
4print(date)
5# Prints in the format year, month, day, hour, minute, second, and microsecond
1from datetime import datetime as d
2date = d.now()
3print(date.strftime("%Y-%m-%d %H:%M:%S"))
1import datetime
2
3x = datetime.datetime(2018, 9, 15)
4
5print(x.strftime("%b %d %Y %H:%M:%S"))
6
1import datetime
2now = datetime.datetime.now()
3print(now.year, now.month, now.day, now.hour, now.minute, now.second)