Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
yura_ratu
Partner - Creator II
Partner - Creator II

Convert to GMT with DST adjustment

Hi Community,

I need to convert two types of Eastern time - with and without DST adjustment - to GMT.

I'm using ConvertToLocalTime function with opposite offset to achieve it. It works fine without DST


   ConvertToLocalTime([Time Local], 'GMT+05:00',-1)


However, when I change last parameter to 0, It doesn't change anything.


   ConvertToLocalTime([Time Local], 'GMT+05:00',0)


The interesting thing is, if I try to use 'GMT-', e.g. like this


   ConvertToLocalTime([Time Local], 'GMT-05:00',0)


DST adjustment works fine, however it is not the timezone I need.


Any ideas how to achieve it?
Thanks

1 Solution

Accepted Solutions
Anonymous
Not applicable

ConvertToLocalTime() Converts a UTC or GMT timestamp to local time as a dual value [pasted from the Help]

Whereas what you are trying to do is the opposite, as in converting a local time to GMT.

Also GMT [aka UTC] does not have daylight saving.  Always best to use a major city for the time zone, e.g. 'New York' as cities do have daylight saving.  Also different cities also change to DST on different days of the year.  Fiji for reasons best know to them a few years back decided to change their DST in November and mid January which seemed to catch most people out.

Qlik for some reason best know to them does not have a ConvertFromLocalTime() function which makes what you are trying to do less than easy.

Have a look at this thread, How to convert from local time? - it may give you some inspiration.

View solution in original post

3 Replies
Not applicable

i think you can use

ConvertToLocalTime([Time Local], 'GMT+05:00') and

ConvertToLocalTime([Time Local], 'GMT+04:00')

Anonymous
Not applicable

ConvertToLocalTime() Converts a UTC or GMT timestamp to local time as a dual value [pasted from the Help]

Whereas what you are trying to do is the opposite, as in converting a local time to GMT.

Also GMT [aka UTC] does not have daylight saving.  Always best to use a major city for the time zone, e.g. 'New York' as cities do have daylight saving.  Also different cities also change to DST on different days of the year.  Fiji for reasons best know to them a few years back decided to change their DST in November and mid January which seemed to catch most people out.

Qlik for some reason best know to them does not have a ConvertFromLocalTime() function which makes what you are trying to do less than easy.

Have a look at this thread, How to convert from local time? - it may give you some inspiration.

yura_ratu
Partner - Creator II
Partner - Creator II
Author

Thank you Bill, Ralf's solution from that old thread helps me