Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rbecher
MVP
MVP

How to convert from local time?

Hi all,

as you might know there is a function ConvertToLocalTime to convert a UTC/GMT timestamp to local time with the adjustment for daylight savings time.

But, how about the other direction? Why there is no function for this?

In my case I have a local time which I need to convert to UTC without daylight savings time! I know I could preload calendar table with daylight saving offset (how to generate?) or something else. But this would be very disappointing...

ConvertFromLocalTime() would be needed or DaylightSaving([timestamp][,place]).

Any suggestion?

- Ralf

Astrato.io Head of R&D
1 Solution

Accepted Solutions
rbecher
MVP
MVP
Author

There is a first idea:

I could act like my local time would be in GMT and do this test calculation for daylight saving:

=if( ConvertToLocalTime(<timestamp>, 'Berlin') - ConvertToLocalTime(<timestamp>, 'Berlin', true()) > 0, 'daylight saving', 'not')

But there should be a better way.

- Ralf

Astrato.io Head of R&D

View solution in original post

9 Replies
Not applicable

Is this relevant to your question?

http://community.qlik.com/message/159051#159051

rbecher
MVP
MVP
Author

No, doesn't help.

Astrato.io Head of R&D
Not applicable

Does this help?

http://community.qlik.com/message/122963

Edit: Probably not. I tried, sorry friend.

rbecher
MVP
MVP
Author

There is a first idea:

I could act like my local time would be in GMT and do this test calculation for daylight saving:

=if( ConvertToLocalTime(<timestamp>, 'Berlin') - ConvertToLocalTime(<timestamp>, 'Berlin', true()) > 0, 'daylight saving', 'not')

But there should be a better way.

- Ralf

Astrato.io Head of R&D
Not applicable

Hi, I have problem with Convert local time  function while i using that =Convertlocaltime(Today(),'kolkata') than its returns 4/20/2012 5:37 AM whenerver the current time is 4/20/2012 4:47 PM. Can guide me what is the exact problem. plzzz.

Not applicable

@rakeshcgbsil

It's probably best to create your own thread instead of bringing up old topics.

Check out this thread, http://community.qlik.com/thread/37530.

suniljain
Master
Master

=ConvertToLocalTime(UTC(),'Kolkata')

kevinpintokpa
Creator II
Creator II

Thanks, I had the same problem, how to convert from local time to UTC with and without daylight savings time and this worked for me 🙂

janbouwmans
Contributor II
Contributor II

Hi Ralf,

I used the following solution based on your idea to convert to GMT in one step:

TimestampGMT=timestamp(ConvertToLocalTime(TimestampLocal,'GMT') - ConvertToLocalTime(TimestampLocal,'Rome')+TimestampLocal)

This automatically corrects for DaylightsavingTime