TO DATE

From Oracle FAQ
Jump to: navigation, search

TO_DATE is a SQL function for converting a character string to an Oracle DATE.

Syntax[edit]

The syntax for the TO_DATE function is:

to_date( string, [ format_mask ], [ nls_language ] )

Where:

  • string is the string that will be converted to a date.
  • format_mask is optional. This is the format that will be used to convert the string to a date.
  • nls_language is also optional. This is the NLS language (regional settings) used to convert the string to a date.

Examples[edit]

SQL> SELECT TO_DATE('4-JAN-2009', 'DD-MON-YYYY') FROM dual;
TO_DATE('
---------
04-JAN-09

Also see[edit]

  • TO_CHAR, function to convert a date or number to a string.
  • TO_NUMBER, function to convert a string to a number.