Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to add two different times in python

import datetime as dt
t1 = dt.datetime.strptime('12:00:00', '%H:%M:%S')
t2 = dt.datetime.strptime('02:00:00', '%H:%M:%S')
time_zero = dt.datetime.strptime('00:00:00', '%H:%M:%S')
print((t1 - time_zero + t2).time())
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #times #python
ADD COMMENT
Topic
Name
1+3 =