Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

1 Solution

Accepted Solutions
rbecher
MVP
MVP

‌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.

Astrato.io Head of R&D

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
MVP
MVP

Hi Yun,

you can use:

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

- Ralf

Astrato.io Head of R&D
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
MVP
MVP

‌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.

Astrato.io Head of R&D
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
MVP
MVP

ConvertToLocalTime() does it automatically..

Astrato.io Head of R&D
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
MVP
MVP

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).

Astrato.io Head of R&D