Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Python :: utf8 python encodage line 
Python :: capture output of os.system in python 
Python :: ImportError: cannot import name ‘json’ from itsdangerous 
Python :: how to print a random part of a list in python 
Python :: sum of all nan values pandas 
Python :: get video width and height cv2 
Python :: python color text on windows 
Python :: n random numbers python 
Python :: qtimer python 
Python :: print two digits after decimal python 
Python :: python check my gpu 
Python :: np array to df 
Python :: get current time in python with strftime 
Python :: django docs case when 
Python :: pandas series to string without index 
Python :: python generate table 
Python :: python check ram usage 
Python :: add column as index pandas 
Python :: conver all dict keys to str python 
Python :: get current month name python 
Python :: python os.getenv not working 
Python :: seaborn hue order 
Python :: discord.py play mp3 file 
Python :: like in mysqldb python 
Python :: como eliminar palabras repetidos de una lista python 
Python :: python import text file 
Python :: import excel file to python 
Python :: python read file without newline 
Python :: how to get the angle of mouse from the center formulae 
Python :: remove unnamed column pandas 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =