Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to convert this time stamp to year and month ?

Christian PitetDec 3 2019 — edited Dec 4 2019

hi

I have a web application who returns a date a a string character like this : 2019-09-01T00:00 (format Year, Month, Day, etc....) I need to return the year like this : "2019". I need also to return the month like this "09". I have played with the function to_timestamp_tz but could not achieve the result.

for example :

select TO_TIMESTAMP_TZ('1999-13-01 11:00:00 -8:00'

       DEFAULT NULL ON CONVERSION ERROR,

       'YYYY-MM-DD HH:MI:SS TZH:TZM')

I feel I am not going on the good direction. Any help welcome.

Regards.

This post has been answered by Frank Kulash on Dec 3 2019
Jump to Answer
Comments
Post Details
Added on Dec 3 2019
14 comments
4,091 views