Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Vivek.

Asked: June 20, 2012 - 4:01 am UTC

Last updated: March 01, 2022 - 2:29 pm UTC

Version: 11g

Viewed 10K+ times! This question is

You Asked

I want to convert a date field that is exists in GMT to New York time. This would be EST/EDT. But I need a query which converts the date to EST or EDT appropriately based on day light savings.

and Tom said...

ops$tkyte%ORA11GR2> select sysdate, from_tz( cast(sysdate as timestamp), 'GMT' ) at time zone 'US/Eastern' from dual;

SYSDATE
--------------------
FROM_TZ(CAST(SYSDATEASTIMESTAMP),'GMT')ATTIMEZONE'US/EASTERN'
---------------------------------------------------------------------------
20-jun-2012 15:33:45
20-JUN-12 11.33.45.000000 AM US/EASTERN




Rating

  (8 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Date Conversion from GMT to EST

Vivek, June 21, 2012 - 7:48 am UTC

The solution is useful to me. I useful do time conversions on date but knowing about time stamp is quite helpful.

Mark, December 15, 2016 - 4:31 pm UTC

Here is an example of selecting an Infor Landmark ERP application GMT TIMESTAMP field showing GMT value in database, 'dbdate' and Eastern time, STARTDATE, in SQL output for a specific row

select pfiworkunit, executionstartdate dbdate, FROM_TZ(cast( executionstartdate AS TIMESTAMP),'GMT') AT TIME ZONE 'US/EASTERN' STARTDATE
from lawpaprd.pfiworkunit
where pfiworkunit = 10225435

Perfect

Saket, January 24, 2017 - 7:40 pm UTC

It works like a charm in my case. Saved me lot of work. Thanks and keep it up
Connor McDonald
January 25, 2017 - 1:44 am UTC

glad we could help

perfect exactly what I was looking for

Deb, December 14, 2017 - 12:55 pm UTC

This was exactly what I was looking for.
Connor McDonald
December 15, 2017 - 6:40 am UTC

glad we could help

Exactly what i was looking for

A reader, September 13, 2018 - 6:55 pm UTC

I always refer to this website and find it very useful. This one was exactly what I am looking for now.
The time zone vlaue can be passed thru a query too as below and it worked.
<from_tz( cast(ol.early_pickup_date+180 as timestamp), 'GMT' ) at time zone (select l.time_zone_gid from location l where l.location_gid = ol.source_location_gid)/>

Thanks a lot Tom!
Chris Saxon
September 14, 2018 - 8:48 am UTC

Great to hear this helped you :)

i have a dout

Thamotharan, March 11, 2019 - 7:14 am UTC

i am having a column like date in that filed i am having a some dates...how i can convert the dates from EST tme....can you help me?

Chris Saxon
March 12, 2019 - 4:23 pm UTC

What exactly are you doing? Show us your code!

A reader, July 08, 2021 - 12:54 pm UTC

Solution is useful.
Connor McDonald
July 09, 2021 - 3:36 am UTC

Thanks

rekha, March 01, 2022 - 4:23 am UTC

i am having a column like date and time in that filed...how i can convert the dates from EST time to GMT.can you help me?we have n number of records.

GENERATION_TIME is the column
18-FEB-20 02.57.03.000000000 PM

Chris Saxon
March 01, 2022 - 2:29 pm UTC

You can use the AT TIME ZONE clause:

select timestamp '2022-02-22 22:02:22 America/New_York' 
         at time zone 'GMT'
from   dual;

TIMESTAMP'2022-02-2222:02:22AMERIC
----------------------------------
23-FEB-2022 03.02.22.000000000 GMT