timeSlots
Function: timeSlots()
Calculates the number of timeslots of the given slot size covered by the given start and end times and returns an array containing the start times of each slot.
Syntax
timeSlots(startDtm, endDtm, slotSize)
Argument | Type | Description |
---|---|---|
startDtm | DateTime | Start time as a string but with a certain format - see date string format. |
endDtm | DateTime | End time as a string but with a certain format - see date string format. |
slotSize | Integer | The size of each slot (in seconds). |
Examples
slotSize(in.startDTM, in.endDTM, 600)
The input record "in" has "20080101.102723" as the startDTM and "20080101.105602" as the endDTM
The function first starts calculating timeslots of the given size from the start of the nearest hour to the startDTM, i.e. from "20080101.102723", until the first slot whose start time is beyond the given endDTM.
In this example this would create 6 timeslots from 10am until 11am but would return the start times for only the last 4 of these since the given startDTM is not contained in the first two.
The result would therefore be:
["20080101.102000","20080101.103000","20080101.104000","20080101.105000"]