Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
rbecher
Partner - Master III
Partner - Master III

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

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
Labels (1)
1 Solution

Accepted Solutions
rbecher
Partner - Master III
Partner - Master III
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

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine

View solution in original post

9 Replies
Not applicable

Is this relevant to your question?

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

rbecher
Partner - Master III
Partner - Master III
Author

No, doesn't help.

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
Not applicable

Does this help?

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

Edit: Probably not. I tried, sorry friend.

rbecher
Partner - Master III
Partner - Master III
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

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
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