📅  最后修改于: 2022-03-11 15:05:19.759000             🧑  作者: Mango
SELECT TO_DATE('14/07/2021','DD/MM/YYYY') FROM DUAL;
WATCH OUT!
/* in the example before if you write '14072021' instead of '14/07/2021'
you'll get the same result, if you want an exception to be thrown you
should add the prefix 'fx' (force) to the format, so that he will
match only the exact format. here's some examples:
SELECT TO_DATE('14/07/2021','fxDD/MM/YYYY') FROM DUAL;--WORKS
SELECT TO_DATE('14072021','DD/MM/YYYY') FROM DUAL; --WORKS
SELECT TO_DATE('14072021','fxDD/MM/YYYY') FROM DUAL;--EXCEPTION */