|Oracle® OLAP DML Reference
10g Release 1 (10.1)
Part Number B10339-02
MAKEDATE(year month day)
An integer expression that represents the year of the test date. For any year, you can specify the year as a four-digit number in the range 1000 to 9999. For years in the range 1950 to 2049 (the default) or some other range (as set through the YRABSTART option), you have the alternative of specifying a two-digit number that represents the last two digits of the year (96 represents 1996, for example).
Any integer expression, normally in the range 1 to 12. When you specify an integer less than 1 or greater than 12, MAKEDATE returns a date in a year prior to or later than the year specified by the integer expression for year.
For example, if the arguments to MAKEDATE are (
21), MAKEDATE returns the date
February 21, 1998 since, in effect, February 1998 is the fourteenth month of 1997.
An integer expression in the range 1 to 31.
When you display the result returned by MAKEDATE, the date is formatted according to the date template in the DATEFORMAT option. When the day of the week or the name of the month is used in the date template, the day names specified in the DAYNAMES option and the month names specified in the MONTHNAMES option are used. You can use the result returned by MAKEDATE anywhere that a DATE value is expected.
You can also use the result where a text value is expected. The date is converted automatically to a text value, using the current template in the DATEFORMAT option to format the text value. When you want to override the current DATEFORMAT template, you can convert the date result to text by using the CONVERT function with a date-format argument.
When the arguments to MAKEDATE do not represent a valid date between January 1, 1000, and December 31, 9999, MAKEDATE returns an
Example 16-52 Converting Integers to a Date
The following statements specify the date format and send the output to the current outfile.
DATEFORMAT = '<mtextl> <d>, <yyyy>' SHOW MAKEDATE(97 11 14)
These statements produce the following output.
November 14, 1997
Example 16-53 Calculating a Date Using YYOR, MMOF, and DDOF Functions
The following statement calculates the date one year from today, and sends the output to the current outfile. The TODAY function returns today's date. The INTEGER functions YYOF, MMOF, and DDOF return the INTEGER values that correspond to the year, month, and day of today's date.
SHOW MAKEDATE(YYOF(TODAY) + 1 MMOF(TODAY) DDOF(TODAY))
When today's date is January 15, 1995, this statement produces the following output.
January 15, 1996