Apr-03-2018, 10:37 PM
Hi all,
I am working on the datetime objects to calculate on between the start and stop time. I want to get the return output to something like this:
For 55 minutes
I want to know how do you use to calculate on the two datetime objects to get the return output for the minutes instead of the hours and seconds?
Thanks in advance.
I am working on the datetime objects to calculate on between the start and stop time. I want to get the return output to something like this:
For 55 minutes
55So when I try this:
self.program_start_time = [datetime.datetime(2018, 4, 3, 23, 15), datetime.datetime(2018, 4, 3, 23, 15), datetime.datetime(2018, 4, 3, 22, 45), datetime.datetime(2018, 4, 3, 23, 20), datetime.datetime(2018, 4, 3, 23, 5), datetime.datetime(2018, 4, 3, 23, 0), datetime.datetime(2018, 4, 3, 23, 0)] self.program_stop_time = [datetime.datetime(2018, 4, 4, 0, 10), datetime.datetime(2018, 4, 4, 0, 15), datetime.datetime(2018, 4, 4, 0, 5), datetime.datetime(2018, 4, 4, 0, 20), datetime.datetime(2018, 4, 4, 0, 10), datetime.datetime(2018, 4, 4, 1, 0), datetime.datetime(2018, 4, 4, 1, 0)] program_start_time = self.program_start_time[0]) program_stop_time = self.program_stop_time[0]) program_minutes = program_stop_time - program_start_time program_minutes = program_minutesI will get the return output like this:
0:55:00I have got no idea how I can get the minutes because the type of the program_minutes is datetime.timedelta. The type for the variable
program_start_time
is datetime.datetime
and program_stop_time
is datetime.datetime
.I want to know how do you use to calculate on the two datetime objects to get the return output for the minutes instead of the hours and seconds?
Thanks in advance.