CenterView Help

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)

ArgumentTypeDescription
startDtmDateTimeStart time as a string but with a certain format - see date string format.
endDtmDateTimeEnd time as a string but with a certain format - see date string format.
slotSizeIntegerThe 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"]

See Also

Please let us know if we could improve this page feedback@phixflow.com