Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python datetime module print 12 hour clock

from datetime import datetime

now = datetime.now()

print(now.strftime('%Y/%m/%d %H:%M:%S')) #24-hour format
print(now.strftime('%Y/%m/%d %I:%M:%S')) #12-hour format
Source by discuss.codecademy.com #
 
PREVIOUS NEXT
Tagged: #python #datetime #module #print #hour #clock
ADD COMMENT
Topic
Name
9+3 =