Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

Tags (1)
13 Replies
Not applicable

Re: QVDCreateTime Default Time Zone

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.

MVP
MVP

Re: QVDCreateTime Default Time Zone

It returns the time as in your local system.

Not applicable

Re: QVDCreateTime Default Time Zone

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

MVP
MVP

Re: QVDCreateTime Default Time Zone

Hi,

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

Regards,

Jagan.

Not applicable

Re: QVDCreateTime Default Time Zone

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

MVP
MVP

Re: QVDCreateTime Default Time Zone

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.

MVP
MVP

Re: QVDCreateTime Default Time Zone

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

Re: QVDCreateTime Default Time Zone

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

MVP
MVP

Re: QVDCreateTime Default Time Zone

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

Community Browser