How to print specific date and time using format in Python

1 Answer

0 votes
import datetime

d = datetime.datetime(2019, 7, 30, 20, 26, 37)

print('{:%Y-%m-%d %H:%M:%S}'.format(d))
 


 
'''
run:
 
2019-07-30 20:26:37
 
'''

 



answered Jul 30, 2019 by avibootz
...