I have a Start Datetime and a End Datetime.
Eg: 10:00 am - 12:00 pm
I have to create 4 slots between the, each ranging for 30 minutes.
Eg:
10:00 am-10:30 am
10:30 am-11:00 am
11:00 am-11:30 am
11:30 am-12:00 pm
This 30 minutes can vary and is not a constant. I have tried a few things but they don't seem to work. Can someone please help. Thank you.
I have tried this but i only get the slot difference not the slotfrom-slotto
with cte as
(
select convert(datetime,CONVERT(VARCHAR(15), getdate(), 112)) as DATE
union all
select c.DATE+'00:20:00' as QuarterTime
from cte c
where c.date<dateadd(minute,1422,convert(datetime,CONVERT(VARCHAR(15), getdate(), 112)))
)
select * from cte