LastDayOfPeriod(Date date, Duration period, Date reference)
Returns the last day of the period in which the given date falls.
Parameters
- date
- The date for which to calculate the last day of the period.
- period
- The duration representing the cycle of periods.
- reference
- The starting date of the sequence.
Returns
Date
Remarks
The cycle of periods is defined by the given period duration, repeated in sequence starting from the provided reference date. If the period is not a whole number of days, the fractional part is ignored.
Examples
LastDayOfPeriod(Today(), Days(7), Date(2006,1,1))
finds the last day of this week assuming the week starts on Sunday, since 1/1/2006 is Sunday.
For weeks starting on Monday, you can use 1/1/2007 as the reference, for example: LastDayOfPeriod(Today(), Days(7), Date(2007,1,1))