Skip to main content

This article has additional information about the DATE_TO_CHAR SQL function.

For convertibility of this function, go to SQL functions  D - H.

DATE_TO_CHAR

Converts a datetime value to a character string of a specific format.

Syntax

DATE_TO_CHAR( datetime, io-format )

Example

DATE_TO_CHAR( start_date, 'MM/DD/YY' )

DATE_TO_CHAR is a convertible function resolved by USoft and thus supported on all RDBMS platforms. However, its exact behaviour partly depends on the underlying RDBMS function.

Oracle

On Oracle, USoft converts the input expression to:

TO_CHAR( datetime, io-format )

SQL Server

On SQL Server, USoft converts the input expression to:

CONVERT( VARCHAR, datetime, io-format )

and this raises an error if io-format is not one of the standardised formats supported for this use of the SQL Server CONVERT() function. For example, the following will raise an error on SQL Server:

CONVERT( VARCHAR, start_date, 'DD-MON-YYYY' )

ODBC

On ODBC, the function has no effect because USoft converts the input expression to:

datetime

JDBC, Derby

On JDBC and Derby, USoft converts the input expression to:

TO_CHARDATE( datetime, NVL( io-format, 'DD-MON-YYYY' ) )

 

Be the first to reply!

Reply