Task

Given the date string "March 7 2009 7:30pm EST", 

output the time 12 hours later in any human-readable format.

As extra credit, display the resulting time in a time zone different from your own.




 
-- March 7 2009 7:30pm EST
 
SELECT 
TO_TIMESTAMP_TZ(
'March 7 2009 7:30pm EST',
'MONTH DD YYYY HH:MIAM TZR'
)
at TIME zone 'US/Eastern' orig_dt_time
FROM dual;
 
-- 12 hours later DST change
 
SELECT 
(TO_TIMESTAMP_TZ(
'March 7 2009 7:30pm EST',
'MONTH DD YYYY HH:MIAM TZR'
)+
INTERVAL '12' HOUR)
at TIME zone 'US/Eastern' plus_12_dst
FROM dual;
 
-- 12 hours later no DST change
-- Arizona time, always MST
 
SELECT 
(TO_TIMESTAMP_TZ(
'March 7 2009 7:30pm EST',
'MONTH DD YYYY HH:MIAM TZR'
)+
INTERVAL '12' HOUR)
at TIME zone 'US/Arizona' plus_12_nodst
FROM dual;
 