Reference Guide > TDV Support for SQL Functions > TDV-Supported Convert Functions > TO_DATE
 
TO_DATE
The TO_DATE function converts a string value to a DATE data type.
Syntax
TO_DATE (expression, date_time_pattern)
Remarks
The expression argument must be a CHAR or VARCHAR. For other input types, use TO_CHAR to cast a CHAR or VARCHAR before using the TO_DATE function.
The pattern argument specifies an output pattern using a DATE, TIME, or NUMERIC format.
You can control the data type returned by TO_DATE with a configuration parameter named Return data type of TO_DATE Function, which is under Server > SQL Engine > Overrides in the Administration > Configuration menu. If you set it to TRUE (the default), the function returns a DATE when format string is specified; if you set it to FALSE, the function returns a TIMESTAMP.
For a change to this configuration parameter to take effect, you need to rebind or explicitly resave the view.
Example
SELECT TO_DATE(‘30 jun 2015’, ‘DD Mon YYYY’);
 
This returns
2015-06-30