TO_DATE - Amazon Redshift


TO_DATE converts a date represented in a character string to a DATE data type.

The second argument is a format string that indicates how the character string should be parsed to create the date value.


TO_DATE (string, format)



String to be converted.


A string literal that defines the format of the input string, in terms of its date parts. For a list of valid formats, see Datetime format strings.

Return type

TO_DATE returns a DATE, depending on the format value.

If the conversion to format fails, then an error is returned.


The following command converts the date 02 Oct 2001 into the default date format:

select to_date ('02 Oct 2001', 'DD Mon YYYY'); to_date ------------ 2001-10-02 (1 row)