Convert Date and time to GMT(date/Time)

Database

Convert Date and time to GMT(date/Time)

Hello ,

I need help on sql where i can convert Date and Time (including day light savings) to GMT .

In my table, I have different City’s like Dallas ,Los Angles, New York , Tokyo etc. for this city’s the time is recorded based on their respective local timings. so I need to convert to them to GMT.

Eg:

Format of my fields..

Date: 02/16/2012

Time: 16:33

Thanks,

Sanjay..

1 REPLY
Junior Supporter

Re: Convert Date and time to GMT(date/Time)

I'm not sure about your data, but assuming you have the time as TIME WITH TIMEZONE you can build a timestamp with time zone and do something like:

SELECT MY_TIMESTAMP_WITH_TIME_ZONE,

       MY_TIMESTAMP_WITH_TIME_ZONE AT TIME ZONE INTERVAL '00:00' HOUR TO MINUTE

  FROM MY_TABLE;

HTH.

Cheers.

Carlos.