DATE

The DATE function returns a date from a value.

Read syntax diagramSkip visual syntax diagram
>>-DATE--(--expression--)--------------------------------------><

expression
An expression that returns a value of one of the following built-in data types: a date, a timestamp, a character string, a graphic string, or any numeric data type.
  • If expression is a character or graphic string, it must not be a CLOB or DBCLOB, and its value must be one of the following:
    • A valid string representation of a date or timestamp. For the valid formats of string representations of dates and timestamps, see String representations of datetime values.
    • A string with an actual length of 7 that represents a valid date in the form yyyynnn, where yyyy are digits denoting a year, and nnn are digits between 001 and 366 denoting a day of that year.
  • If expression is a number, it must be a positive number less than or equal to 3 652 059.

The result of the function is a date. If the argument can be null, the result can be null; if the argument is null, the result is the null value.

The other rules depend on the data type of the argument:

Note

Syntax alternatives: The CAST specification should be used to increase the portability of applications when the argument is a date, timestamp, or character string. For more information, see CAST specification.

Examples