sql to_date code example
Example 1: oracle to date
SELECT
TO_DATE( '5 Jan 2017', 'DD MON YYYY' )
FROM
dual;
INSERT INTO members(first_name, last_name, joined_date)
VALUES('Laureen','Davidson', TO_DATE('Feb 01 2017','Mon DD YYYY'));
Example 2: sql to_date
SELECT TO_DATE('2012-06-05', 'YYYY-MM-DD') FROM dual;
SELECT TO_DATE('05/06/2012 13:25:12', 'DD/MM/YYYY HH24:MI:SS') FROM dual;
SELECT CONVERT(DATETIME, '2012-06-05', 102);
SELECT TRY_CONVERT(DATETIME, '2012-06-05', 102);
SELECT STR_TO_DATE('2012-06-05','%Y-%m,%d');
Example 3: str_to_date sql server
SELECT STR_TO_DATE('17-09-2010','%d-%m-%Y');