to date oracle

Solutions on MaxInterview for to date oracle by the best coders in the world

showing results for - "to date oracle"
Cristina
27 Jan 2017
1-- TO_TIMESTAMP(date_string,'YYYY-MM-DD HH24:MI:SS')
2SELECT TO_TIMESTAMP('2021-02-21 23:12:01','YYYY-MM-DD HH24:MI:SS') FROM DUAL;
Virgile
06 May 2020
1SELECT
2  TO_DATE( '5 Jan 2017', 'DD MON YYYY' )
3FROM
4  dual;
5
6---or----
7INSERT INTO members(first_name, last_name, joined_date)
8VALUES('Laureen','Davidson', TO_DATE('Feb 01 2017','Mon DD YYYY'));
Ylann
09 Aug 2020
1SELECT TO_DATE('14/07/2021','DD/MM/YYYY') FROM DUAL;
2
3                                  WATCH OUT! 
4/*	  in the example before if you write '14072021' instead of '14/07/2021'
5      you'll get the same result, if you want an exception to be thrown you    
6      should add the prefix 'fx' (force) to the format, so that he will 
7      match only the exact format. here's some examples:
8         SELECT TO_DATE('14/07/2021','fxDD/MM/YYYY') FROM DUAL;--WORKS
9         SELECT TO_DATE('14072021','DD/MM/YYYY') FROM DUAL;    --WORKS
10         SELECT TO_DATE('14072021','fxDD/MM/YYYY') FROM DUAL;--EXCEPTION      */