Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Read about Qlik’s Response to COVID-19 Read the Letter, Join the Group.
Contributor III

Daylight saving parameter in ConvertToLocalTime function

Hi,

I'm using ConvertToLocalTime function, but I'm having problems with daylight saving times. Checking the manual I've found that:

ConvertToLocalTime(timestamp [, place [, ignore_dst=false]])

Converts a UTC or GMT timestamp to local time as a dual value. The place can be any of a number

of cities, places and time zones around the world.

But there's no example about how to use dst flag. I've tried to add True (to enable dst) as a third parameter but it doesn't work. Could you please advise regarding how to use this function correctly.

Thanks in advance,

Regards.

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: Daylight saving parameter in ConvertToLocalTime function

Hi

Use True() - it is a function, so it needs the parentheses. Or else use -1 which is the numeric equivalent.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

6 Replies
Highlighted
Not applicable

Re: Daylight saving parameter in ConvertToLocalTime function

Hi

Pls try below things

ConvertToLocalTime handles DST by default. See ConvertToLocalTime function in the Ref Guide or the Help.

you can use ConverToLocalTime(DateField) and are you  return the data based on the windows timezone, or you have the file in a server? which Time Zone you are trying to get Windows or Server time zone.

ConvertToLocalTime( timestamp [, place [, ignore_dst=false]]])

You still need to specify the place.

ConvertToLocal(timestamp, 'GMT-5:00')

will convert the timestamp to GMT-5:00 and take into account whether timestamp falls into a DST range.

I think the default timezone is always the server.

Highlighted
Contributor III

Re: Daylight saving parameter in ConvertToLocalTime function

Hi Saumil,

Thank you for your help. Actually I'm getting the current time from my server which is in MST (GMT-7:00). Just, one additional question, if I need to convert this time to another timezone, let say EST, is it ok to use the function in the following way?

=ConvertToLocalTime(Timestamp(now()), 'GMT-05:00')

Regards,

Highlighted
MVP
MVP

Re: Daylight saving parameter in ConvertToLocalTime function

Hi

Use True() - it is a function, so it needs the parentheses. Or else use -1 which is the numeric equivalent.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

Highlighted
Not applicable

Re: Daylight saving parameter in ConvertToLocalTime function

Hi Karla

LocalTime([timezone [, ignoreDST ]])

Returns a timestamp of the current time from the system clock for a specified time zone. The timezone is specified as a string containing any of the geographical places listed under Time Zone in the Windows Control Panel for Date and Time or as a string in the form 'GMT+hh:mm' or 'UTC+hh:mm'. If no timezone is specified the local time will be returned. If ignoreDST is -1 (true) daylight savings time will be ignored.

Examples:

localtime ('Paris')

localtime ('GMT+01:00')

localtime ('Paris',-1)

localtime()

Highlighted
Contributor III

Re: Daylight saving parameter in ConvertToLocalTime function

Hi Jonathan,

I tried that out and it worked like you said.

Thank you.

Highlighted
Contributor

Re: Daylight saving parameter in ConvertToLocalTime function

Hi ,

I am trying to print as

10/19/2017 10:00 AM CST

I also need to print zone 'CST or EST ' etc based on user system time

can you please tell how to achieve this

ConvertToLocalTime  is simply giving me  10/19/2017 10:00 AM

also localtime() , now() , today() same results