question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handling Time Zone Not Support

See original GitHub issue

I am using presto through AWS Athena and trying to take user generated events in UTC and convert them to the users own time zone. I am not sure if it’s due to Athena’s version of presto not being up to date, but some users have time zones that presto doesn’t recognize. In my case it’s 'Asia/Yangon'

SELECT at_timezone(timestamp '2020-01-01', 'Asia/Yangon')

NOT_SUPPORTED: Time zone not supported: Asia/Yangon

Unfortunately, I don’t have the ability to update Athena’s version of presto if that would solve this. Even if I were able to, it’s possible a user reports a new or non-existing time zone at any time, breaking any query that uses at_timezone that happen to include their events.

I tried using a try here but it doesn’t catch this type of error.

SELECT try(at_timezone(timestamp '2020-01-01', 'Asia/Yangon'))

Is there a way I can safely attempt to change the time zone of a timestamp, or is there a list of valid time zones for presto I can filter on?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
micah-williamsoncommented, Jul 30, 2020

That’s all. I didn’t know if you wanted to leave it open if the try was supposed to catch this error.

1reaction
micah-williamsoncommented, Jul 30, 2020

Thank you for that list. With it i was able to easily find which time zones Athena’s version of presto is unable to match. With that I can create a fallback. From our data we could map:

-- These time zones can match to another time zone in the same offset
America/Fort_Nelson => America/Denver
Asia/Barnaul => Asia/Novosibirsk
Asia/Tomsk => Asia/Novosibirsk
Europe/Astrakhan => Europe/Volgograd
Europe/Kirov => Europe/Istanbul
Europe/Ulyanovsk => Europe/Volgograd
America/Punta_Arenas => America/Sao_Paulo
Asia/Atyrau => Asia/Tashkent
Asia/Famagusta => Asia/Jerusalem
Europe/Saratov => Europe/Volgograd

-- This one doesn't exist in the current presto time zones list
Asia/Qostanay => Antarctica/Vostok

-- These time zones don't match any time zone in the same offset, and so are a closest approximation
Asia/Yangon => Asia/Bangkok
India/Cocos => Asia/Bangkok
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Handle Timezones and Synchronize Your Software ...
Rule #1 : Timestamps are only for saving, not for displaying. It's considered on UTC because it doesn't include any offset or time...
Read more >
Handling Time Zone in JavaScript - TOAST UI - Medium
For the server to support clients from various time zones, the schedule stored in the server must have absolute values that are not...
Read more >
Guide to time zone handling for REST APIs in Java - LinkedIn
It is true that handling timezone could be tricky sometimes, not only for the APIs but also for mobile apps and distributed web...
Read more >
Problem with timezone handling (caused by ... - Drupal
I set the time zone handling to site's time zone and the ... But the "Date's time zone" and "No time zone conversion"...
Read more >
Working with Time Zones - W3C
Abstract. This document contains guidelines and best practices for working with time and time zones in applications and document formats.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found