Reputation: 924
Following is my code sample. I need to convert the need_by in varchar2 to need_by_date in date format. The timezone information is where i am getting the issue. What is the correct format string for this date format?
declare
need_by varchar2(50);
need_by_date date;
begin
need_by := '2014-11-24T04:31:43.967Z';
need_by_date := to_date(need_by,'yyyy-MM-dd"T"HH24:MI:ss');
DBMS_OUTPUT.PUT_LINE(need_by_date);
end;
Thanks in advance
Upvotes: 0
Views: 178
Reputation: 8797
select to_timestamp('2014-11-24T04:31:43.967Z', 'yyyy-MM-dd"T"HH24:MI:SS.FF3"Z"') at time zone 'UTC' from dual;
(".967" is fraction seconds, "Z" is UTC)
Upvotes: 2