TO_CHAR

The TO_CHAR function formats a date value into a string.

Syntax

TO_CHAR( dateExpr, format );

dateExpr

The date value that you want to format.

format

A string that specifies the format you want applied to the date. You can specify formats such as the following:

yyyy-mm-dd

mm/dd/yyyy

dd.mm.yy

dd-mm-yy

Results

This function returns a string (CHAR) value.

Examples

splice> VALUES TO_CHAR(CURRENT_DATE, 'mm/dd/yyyy');
1
----------------------------------------------------
09/22/2014
1 row selected

splice> VALUES TO_CHAR(CURRENT_DATE, 'dd-mm-yyyy');
1
----------------------------------------------------
22-09-2014
1 row selected

splice> VALUES TO_CHAR(CURRENT_DATE, 'dd-mm-yy');
1
----------------------------------------------------
22-09-14

See Also