Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Convert Local Time to UTC with Daylight Saving Handled Automatically

Hi

I was trying to capture the create time of a QVD file and convert it from local time to UTC.

But I found that QVDCreateTime function will return a timestamp with timezone UTC rather than my local time zone.

Can we control the timezone of the return from QVDCreateTime function?

Thank you

Paco

13 Replies
Not applicable
Author

I should have said that I think the return of QVDCreateTime function default the time zone to be 'UTC' while the time value is in local time.

Hope that will make it clear.

tresesco
MVP
MVP

It returns the time as in your local system.

Not applicable
Author

Hi tresesco:

Thank you for your reply. But I don't think what you are saying is the case.

Can you try the following two lines of script?

LET v1 = TIMESTAMP(CONVERTTOLOCALTIME(QVDCREATETIME('[Your QVD File]'),'UTC'), 'YYYY-MM-DD hh:mm:ss');

LET v2 = TIMESTAMP(QVDCREATETIME('[Your QVD File]'), 'YYYY-MM-DD hh:mm:ss');

I am not in UTC, but the above script will result in v1 equal to v2.

Let me know what do you get from the above script.

Cheers,

PC

jagan
Luminary Alumni
Luminary Alumni

Hi,

It will return the local system time, check your system is in UTC zone.

Regards,

Jagan.

Not applicable
Author

Hi Jagan:

Where can I check my system timezone.

If I click on the clock on the bottom right and click 'Change date and time settings...', then it is showing the following:

(UTC+10:00) Canberra, Melbourne, Sydney

Please let me know if I am looking at the wrong place.

Thank you.

PC

tresesco
MVP
MVP

Let's not make it complicated. Why don't we try simply

Let vQVDtime = QvdCreateTime('[Your QVD File]');

Don't you get the time of your Windows time in the variable? I get it so.

tresesco
MVP
MVP

To answer your ConvertToLocaTime() - it takes input as UTC/GMT and if you convert it to UTC again it will always return the same output. Hope this explains your query.



So it's about understanding the ConvertToLocalTime() function right.

Not applicable
Author

Hi tresesco:

Thanks for your clarification. That make sense now.

Then I have another questions. How can I convert a local time to UTC with Daylight Saving handled automatically?

Thank you.

PC

tresesco
MVP
MVP

ConvertToLocalTime(YourTime, 'UTC-10:00');  ?