to date oracle with time
-- TO_TIMESTAMP(date_string,'YYYY-MM-DD HH24:MI:SS')
SELECT TO_TIMESTAMP('2021-02-21 23:12:01','YYYY-MM-DD HH24:MI:SS') FROM DUAL;
to date oracle with time
-- TO_TIMESTAMP(date_string,'YYYY-MM-DD HH24:MI:SS')
SELECT TO_TIMESTAMP('2021-02-21 23:12:01','YYYY-MM-DD HH24:MI:SS') FROM DUAL;
oracle to date
SELECT
TO_DATE( '5 Jan 2017', 'DD MON YYYY' )
FROM
dual;
---or----
INSERT INTO members(first_name, last_name, joined_date)
VALUES('Laureen','Davidson', TO_DATE('Feb 01 2017','Mon DD YYYY'));
to date oracle
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 */
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us