- Function MomentToTimeSlot(Calendar, ReferenceDate, Elapsed)
MomentToTimeSlot
The function MomentToTimeSlot
determines the time slot in a calendar
that corresponds with the a moment that is specified as the elapsed time
since a specific reference date.
MomentToTimeSlot(
Calendar, ! (input) a calendar
ReferenceDate, ! (input) an element (time-slot) in the calendar
Elapsed ! (input) a numerical value
)
Arguments
- Calendar
An identifier of type calendar.
- ReferenceDate
A specific time-slot in Calendar holding the reference time.
- Elapsed
The elapsed time since ReferenceDate. This should be an integral multiple of the calendar’s time unit in order to select the time slot that is the return value of this function.
Return Value
The function
MomentToTimeSlot
returns the time slot in the calendar that contains the given moment. When the time slot is outside the calendar the empty element is returned.
Example
The code
ep_nextYear := MomentToTimeSlot(
Calendar : cal_days,
ReferenceDate : '2021-01-01',
Elapsed : 365[day]);
display ep_nextYear ;
gives the result:
ep_nextYear := '2022-01-01' ;
See also
The functions TimeSlotToMoment
, CurrentToTimeSlot
, StringToTimeSlot
.