May-01-2018, 07:08 PM
Hi all,
I am working on datetime.datetime objects to calculating between
When I try this:
Here it is the input for the variables:
program_start_time:
I am working on datetime.datetime objects to calculating between
19:00
and 22:15
. I want to calculating the datetime objects and then multiply by the value 11.4
.When I try this:
program_time = program_stop_time - program_start_time program_duration = program_time * 11.4I will get an error: TypeError: unsupported operand type(s) for *: 'datetime.timedelta' and 'float'
Here it is the input for the variables:
program_start_time:
2018-05-01 19:00:00program_stop_time:
2018-05-01 22:15:00Here is the return output when I calculating:
3:15:00Here is the code:
start_time = time.strptime(program_start_date, '%Y%m%d%H%M%S') program_start_time = datetime.datetime.fromtimestamp(time.mktime(start_time)) stop_time = time.strptime(program_stop_date, '%Y%m%d%H%M%S') program_stop_time = datetime.datetime.fromtimestamp(time.mktime(stop_time)) program_duration = program_stop_time - program_start_timeHere is what I want to achieve:
3591Can you please help me how to correct the error to allow me to calculating the datetime object and multiply the value to get the return output I want??