Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys!
I'm having a trouble generating a DateTime calendar. I need to generate a calendar with dates, hours, half hours, quarter hours and minute.
This is my code (without quarter hour) but it doesn't work correctly. Can someone please suggest me how to generate it?
LET start = Num(Date#('2014-07-09', 'YYYY-MM-DD'));
LET end = Num(Today());
LET days = $(end) - $(start);
DateTimeCalendar:
LOAD
Date(Num(IterNo() + $(start) - 1)) as Date,
Hour(Timestamp($(start) + ((RecNo() - 1) / 1440) + (IterNo() - 1))) as Hour,
Timestamp($(start) + ((RecNo() - 1) / 48) + (IterNo() - 1), 'hh:mm') as HalfHour,
Minute(Timestamp($(start) + ((RecNo() - 1) / 1440) + (IterNo() - 1))) as Minute
AutoGenerate 1440
While IterNo() + $(start) - 1 <= $(end);
Thanks so much.
Try
LET start = Num(Date#('2014-07-09', 'YYYY-MM-DD'));
LET end = Num(Today());
LET days = $(end) - $(start);
DateTimeCalendar:
LOAD
Date(Num(IterNo() + $(start) - 1)) as Date,
mod(floor(RecNo()/60),24) as Hour,
mod(floor(RecNo()/30),2)+1 as HalfHour,
mod(floor(RecNo()/15),4)+1 as Quarter,
mod(recno(),60) as Minute
AutoGenerate 1440
While IterNo() + $(start) - 1 <= $(end);