I want to make a function that will take start_time
and end_time
and that will find the time interval where those times fit.
Time range must be at every 5 minutes, but imputed time interval can be any other time.
I have these intervals (I made them with a function below):
00:00:00
00:05:00
00:10:00
00:15:00
00:20:00
00:25:00
00:30:00
00:35:00
00:40:00
00:45:00
00:50:00
00:55:00
import datetime
import pandas as pd
import time
# creating time intervals at every 5 minutes
def find_interval(start_time, end_time):
start_time = "00:00:00"
end_time = "0:59:59"
start = datetime.datetime.strptime(start_time, '%H:%M:%S')
end = datetime.datetime.strptime(end_time, '%H:%M:%S')
step = datetime.timedelta(minutes=5)
time_intervals = []
while start <= end:
time_intervals.append(start.time())
#print(start.time())
start += step
#print(time_intervals)
What should I do, so that when user enters start_time
and end_time
,
for example 00:13:24
and 00:22:41
, i get the result:
[00:10:00, 00:15:00, 00:20:00, 00:25:00]