TO_DATE
TO_DATE(string [,fmt [,'nlsparams']])

Converts the character-string representation of a date/time value into a value of type DATE.

Parameters

string

Specifies a character-string representation of the date/time value to be converted.

fmt

Specifies a date format string made up of the elements shown in Table 5-4.

nlsparams

Specifies a string in the form NLS_DATE_LANGUAGE=langname, where langname represents a valid NLS language name. The NLS language name affects the spelling used for day and month names.

Example

DECLARE
  x DATE;
BEGIN
  x := TO_DATE('21-May-2000','dd-Mon-yyyy');

  x := TO_DATE('5/21/2000 7:15 PM','mm/dd/yyyy hh:mi pm');
END;

Get Oracle SQL: the Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.