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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Converting GMT to UTC-4 TimeStamp

Hello,

How can I convert the TimeStamp from GMT to UTC-4?

For example, I have the data field call "submitted date" which is GMT time. How can I convert it to local time UTC-4?

Also, if I want to get the month after converted the time. What will be the full command line looks like?

Thanks,

Becky

Labels (1)
1 Solution

Accepted Solutions
rbecher
Partner - Master III
Partner - Master III

‌Just use your fieldname. <  > was a placeholder..

Btw, this is the only function taking care of daylight saving in target time zone. So, first example subtracting 4 hrs might not work in all situations.

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

View solution in original post

9 Replies
iahamedabdullah
Partner - Contributor II
Partner - Contributor II

Hi Give a try,

1. To get UTC-4 use this Expression: Timestamp(submitted date-Time#(4,'hh'))

2. To get Month after conversion: Month(Timestamp(submitted date-Time#(4,'hh')))

rbecher
Partner - Master III
Partner - Master III

Hi Yun,

you can use:

=ConvertToLocalTime(<YourTimeField>, 'GMT-04:00')

- Ralf

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

Thanks Ralf.

Is your way suppose to use in script when load date, or use in expression?
I used the way in Expression. It shows error. Where should I  change?

Not applicable
Author

Thanks! It works.

One more question, I can use this in expression right? Or I can use this both in script and expression?

rbecher
Partner - Master III
Partner - Master III

‌Just use your fieldname. <  > was a placeholder..

Btw, this is the only function taking care of daylight saving in target time zone. So, first example subtracting 4 hrs might not work in all situations.

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

Thanks Ralf.

Is there a way that we can do with the daylight saving? Or we have to manually change the expression?

rbecher
Partner - Master III
Partner - Master III

ConvertToLocalTime() does it automatically..

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

Oh, thanks. I think I got confused from your previous comments. I thought the ConverToLocalTime() won't work for day light saving...

So for those country they don't have daylight saving, shall I use "Timestamp(Date - Time#(4,'hh'))"?

rbecher
Partner - Master III
Partner - Master III

It should work also for places having no daylight savings but I'm not sure if the parameter is not a place but a GMT value. I think it would be probably better to use places (see help).

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