Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
jonathandienst
Partner - Champion III
Partner - Champion III

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
Not applicable
Author

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.

Anonymous
Not applicable
Author

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,

jonathandienst
Partner - Champion III
Partner - Champion III

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
Not applicable
Author

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

Anonymous
Not applicable
Author

Hi Jonathan,

I tried that out and it worked like you said.

Thank you.

qvqfqlik
Creator
Creator

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