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: 
ammarahw
Contributor III
Contributor III

I am trying to convert an event time stamp from UTC to the specific time zone the event took place in.

I have some geographic fields around the events including zip codes, cities, a field that specifies the time zone that the event happened in. All of the event time stamps are in UTC but I want to create a field that lets me convert the event time stamps from UTC to the time zone specified in the event. 

I tried using Converttolocaltime but it didn't work:

=ConvertToLocalTime(UTC([received_at]), time_zone)

where received_at is the timestamp of when the event took place and the field that specifies the time zone is time_zone. It seems to be converting the time correctly but it is converting the current time to the specified time zones instead of the received at. 

Is there another function I should be using?

Labels (4)
2 Solutions

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You should not use the UTC() function here. Your expression should be just:

=ConvertToLocalTime(received_at], time_zone)

UTC() returns the current UTC time. UTC(x) just ignores x, so you are converting the current UTC to local time. 

-Rob

View solution in original post

ammarahw
Contributor III
Contributor III
Author

Thank you this worked!

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You should not use the UTC() function here. Your expression should be just:

=ConvertToLocalTime(received_at], time_zone)

UTC() returns the current UTC time. UTC(x) just ignores x, so you are converting the current UTC to local time. 

-Rob

ammarahw
Contributor III
Contributor III
Author

Thank you this worked!