Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Convert UTC to CPT

I am trying to convert my UTC Field to CPT - any idea how to do this?

I've used "ConvertToLocalTime" but that doesn't appear to be working, neither does the  "daylightsaving" function.

Here are my two fields I am working off of:

StartUTC

EndUTC

Thank you! 

dawn

9 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Hi Dawn,

I'm not sure which time zone CPT is - it's not defined here - List of time zone abbreviations - Wikipedia, the free encyclopedia

Would suggest though that if it's a fixed offset from GMT, you could try something like this:

ConvertToLocalTime(StartUTC(), ’GMT-05:00’)

Marcus

Nicole-Smith

For ConvertToLocalTime(), you need to use a place in the following list:

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.

Valid places and time zones:

Abu Dhabi, Adelaide, Alaska, Almaty, Amsterdam, Arizona, Astana, Athens, Atlantic Time (Canada), Auckland, Azores, Baghdad, Baku, Bangkok, Beijing, Belgrade, Berlin, Bern, Bogota, Brasilia, Bratislava, Brisbane, Brussels, Bucharest, Budapest, Buenos Aires, Cairo, Canberra, Cape Verde Is., Caracas, Casablanca, Central America, Central Time (US & Canada), Chennai, Chihuahua, Chongqing, Copenhagen, Darwin, Dhaka, Eastern Time (US & Canada), Edinburgh, Ekaterinburg, Fiji, Georgetown, Greenland, Greenwich Mean Time : Dublin, Guadalajara, Guam, Hanoi, Harare, Hawaii, Helsinki, Hobart, Hong Kong, Indiana (East), International Date Line West, Irkutsk, Islamabad, Istanbul, Jakarta, Jerusalem, Kabul, Kamchatka, Karachi, Kathmandu, Kolkata, Krasnoyarsk, Kuala Lumpur, Kuwait, Kyiv, La Paz, Lima, Lisbon, Ljubljana, London, Madrid, Magadan, Marshall Is., Mazatlan, Melbourne, Mexico City, Mid-Atlantic, Midway Island, Minsk, Monrovia, Monterrey, Moscow, Mountain Time (US & Canada), Mumbai, Muscat, Nairobi, New Caledonia, New Delhi, Newfoundland, Novosibirsk, Nuku'alofa, Nuku´alofa, Osaka, Pacific Time (US & Canada), Paris, Perth, Port Moresby, Prague, Pretoria,Quito, Rangoon, Riga, Riyadh, Rome, Samoa, Santiago, Sapporo, Sarajevo, Saskatchewan, Seoul, Singapore, Skopje, Sofia, Solomon Is., Sri Jayawardenepura, St. Petersburg, Stockholm, Sydney, Taipei, Tallinn, Tashkent, Tbilisi, Tehran, Tijuana, Tokyo, Ulaan Bataar, Urumqi, Warsaw, Wellington, West Central Africa, Vienna, Vilnius, Vladivostok, Volgograd, Yakutsk, Yerevan or Zagreb.

Also GMT, GMT-01:00, GMT+04:00 etc. are valid places.

The resulting time is adjusted for daylight savings time, unless the third parameter is set to 1 or true().

Examples:

ConvertToLocalTime(’2007-11-10 23:59:00’,’Paris’) returns ’2007-11-11 00:59:00’ and the corresponding internal timestamp representation.

ConvertToLocalTime(UTC(), ’GMT-05:00’) returns the time for the North American east coast, e.g. New York.

I don't know what CPT is, so I can't tell you what you need to use.

Not applicable
Author

Thanks Nicole, but I have tried that from the Help menu and it is not working.

CPT is Central Prevailing Time - this way I would not have to reconfigure the APP for Daylight savings.

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Dawn,

have you tried :

ConvertToLocalTime(StartUTC, 'Central Time (US & Canada)' , false)

Marcus

Nicole-Smith

ConvertToLocalTime(StartUTC, 'Central Time (US & Canada)') should give you what you need, and it should also automatically adjust for daylight savings.

Not applicable
Author

Marcus, what is the "false" for at the end of the statement ?

Nicole-Smith

The "false" tells the calculation to use daylight savings time.  However, it isn't needed because QlikView defaults to that.  The only time you need the third argument is if you want it to be true and to not use daylight savings time.

Not applicable
Author

Then I don't need it, and I have tried that combination before and it does not work.

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Hi Dawn,

it might be useful if you could give us for example a spreadsheet showing your source datetimes in UTC, your expected result, and your actual result.

Marcus