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

Related questions

1 answer 163 views
2 answers 207 views
207 views asked Jun 6, 2019 by avibootz
1 answer 180 views
1 answer 301 views
1 answer 136 views
1 answer 231 views
...