How to format time in Python

1 Answer

0 votes
import time  

spt = time.strptime(time.ctime())     
   
print(time.strftime("%a %b %d %H:%M:%S %Y", spt))

print(time.strftime("%m/%d/%Y, %H:%M:%S", spt))



'''
run:

Mon Jun 03 15:38:28 2019
06/03/2019, 15:38:28

'''

 



answered Jun 3, 2019 by avibootz
...