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 170 views
2 answers 212 views
212 views asked Jun 6, 2019 by avibootz
1 answer 184 views
1 answer 309 views
1 answer 145 views
1 answer 239 views
...