Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Oracle string to date wtih timezone

Tags:

oracle

plsql

I can convert this string to a date

select to_date('2013-10-15T17:18:28', 'YYYY-mm-DD"T"HH24:MI:SS') from dual

But how can I convert this string

'2013-10-15T17:18:28-06:00'

which includes a timezone?

like image 565
EvilEddie Avatar asked Oct 02 '22 17:10

EvilEddie


1 Answers

Use TO_TIMESTAMP_TZ instead:

select to_timestamp_tz('2013-10-15T17:18:28-06:00'
                      ,'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM')
from dual;

15/OCT/13 05:18:28.000000000 PM -06:00
like image 132
Jeffrey Kemp Avatar answered Oct 05 '22 23:10

Jeffrey Kemp