Returns a formatted date-string.
Syntax
FormatDate ( date, internal-date-format )
Parameter | Description |
---|---|
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 attribute properties of a member can also be used to retrieve this number. For example,
|
internal-date-format | One of the following literal strings (excluding ordered-list numbers and parenthetical examples) indicating a supported date format.
|
Notes
Using an invalid input date returns an error.
Using extra whitespace not included in the internal format strings returns an error.
This function interprets years in the range 1970 to 2029 for yy format. Therefore, if the function is invoked using a date format mm/dd/yy for June 20, 2006, the returned date string is "06/20/06".
Example
The following query returns the first 10 day sales for all Colas products since their release date in the market California.
WITH MEMBER Measures.[first 10 days sales] AS 'SUM( LastPeriods(-10, StrToMbr( FormatDate("Mon dd yyyy", Product.CurrentMember.[Intro Date]) ) ) , Sales)' SELECT {[first 10 days sales]} ON COLUMNS, {Colas.Children} ON ROWS FROM MySamp.basic WHERE (California, Actual);