TO_DATE

Purpose

This function converts a string into a date.

Syntax

to_date::=

Usage Notes

  • If no format is specified, the standard format is used to interpret string, this is defined in session parameter NLS_DATE_FORMAT.
  • For information, refer to the Date/Time Format Models.
  • ISO formats (IYYY, IW, ID) may not be mixed with non-ISO formats.
  • If single elements are omitted, then their minimum values are assumed (for example, TO_DATE('1999-12', 'YYYY-MM') is interpreted as December 1st, 1999).
  • Session parameter NLS_DATE_FORMAT defines the output of the date.

Example

SELECT TO_DATE('1999-12-31') TO_DATE;

SELECT TO_DATE('31-12-1999', 'DD-MM-YYYY') TO_DATE;