Answers for "12 hour time python code"

0

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
Posted by: Guest on June-29-2020
0

python convert 12 hour time to 24 hour

df['Time'] = pd.to_datetime(df['Time'], format='%I:%M:%S %p').dt.strftime('%H:%M:%S')
print (df)
       Time
1  17:21:26
2  17:21:58
3  17:22:22
4  17:22:36
5  19:18:16
Posted by: Guest on December-02-2021

Code answers related to "12 hour time python code"

Python Answers by Framework

Browse Popular Code Answers by Language