Calendar Periods

Format

P2 Server provides functions for calculating the time of specific calendar periods. The functions all require the same parameters and are used in the same way, but produce a result relevant to the function. 

Functions

Format Returns
CalendarDayStart(Time [,TimeZone]) The time of midnight on the morning of the day of the provided Time.
CalendarMonthEnd(Time [,TimeZone]) The time of the end of the calendar month, which started on or before the provided Time. That is, 23:59:59 on the last day.
CalendarMonthStart(Time [,TimeZone]) The time of the start of the calendar month, occurring on or before the provided Time.
CalendarWeekEnd(Time [,TimeZone]) The time of midnight on the morning of the first day of the week occurring after the provided Time. That is, the end of the week which started on or before the provided Time. Assumes that the week starts on the day specified by the data value.
CalendarWeekEnd2(Time [,TimeZone]) The time of midnight on the Sunday morning occurring after the provided Time. That is, the end of the calendar week which started on or before the provided Time, assuming Sunday is the first day of the week.
CalendarWeekStart(Time [,TimeZone]) The time of midnight on the morning of the first day of the week occurring on or before the provided Time. Assumes that the week starts on the day specified by the data value.
CalendarWeekStart2(Time [,TimeZone]) The time of midnight on the Sunday morning occurring on or before the provided Time. That is, the start of the calendar week, assuming Sunday is the first day of the week.
DaysInMonth(Time [,TimeZone]) The number of days in the month of the provided Time
Midnight(Time [,TimeZone]) The time of the midnight occurring on or before the provided Time. That is, the start of the day. 

Inputs

Time: The time from which to calculate the start of the calendar period.
Behaviour: Required
Dimension: Collection, SingleValue, MultiCollection
Valid data types: DateTime, Decimal, Integer, String

Note: You can use the Time() function to use a valid DateTime argument.

TimeZone: The geographical or UTC offset time zone (e.g. "Australia/Perth" or "UTC+08:00"). If not supplied, it assumes the configured calendar time zone. 
Behaviour: Optional
Dimension: SingleValue
Valid data types: String

How to format data types

Examples

Expression: Midnight({utc'2017-06-13 18:29'}, "Australia/Perth")
Result: 14/06/2017 12:00 AM

Expression: Midnight(Time(), "Australia/Perth")
Result: The time at midnight in the specified time zone.
E.g. 14/06/2017 12:00 AM

Release History

  • Calendar Periods 4.6.5
    • Changed Time parameter to support MultiCollection values.
  • Calendar Periods 4.0
    • Initial version

 

 

Comments are closed