GetRoundDate

For a given date_part, this function returns the rounded date of the input date to the input time interval, following a standard Gregorian calendar.

Syntax

GetRoundDate ( date, date_part )
ParameterDescription

date

A number representing the input date between January 1, 1970 and Dec 31, 2037. The number is the number of seconds elapsed since midnight, January 1, 1970. To retrieve this number, use any of the following functions: Today(), TodateEx(), GetFirstDate(), GetLastDate(), DateRoll().

Date-Time type attribute properties of a member can also be used to retrieve this number. For example: Product.currentmember.[Intro Date] returns the Introduction or release date for the current product in context. [Cola].[Intro Date] returns the Introduction or release date for the “Cola” product.

date_part

Defined time components of the standard calendar.

  • DP_YEAR - year of the input date.

  • DP_QUARTER – quarter of the input date.

  • DP_MONTH - month of the input date.

  • DP_WEEK - week of the input date.

Example

Assuming today’s date is April 15 2007, consider the following scenarios.

GetRoundDate(Today(), DP_YEAR)

returns the rounded date to the year, Jan 1 2007

GetRoundDate(Today(), DP_QUARTER)

returns the rounded date to the quarter, Apr 1 2007

GetRoundDate(Today(), DP_MONTH)

returns the rounded date to the month, Apr 1 2007

GetRoundDate(Today(), DP_WEEK)

returns the rounded date to the week, Apr 15 2007

See Also