-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
listTimeZones() to filter the deprecated timezones #10
Comments
Actually, the array of time zone names returned by Deprecated time zones are not exposed by any public function. They are exported as Do you see any time zone returned by |
Hello @prantlf, I want to display timezone with their offset. Can you tell me how can I achieve that? |
@nilamsavani91, a time zone has no single offset. The offset will be known, as soon as you say what country and date you want to know the offset for. The reason is that the rules for daylight-saving changes are different in different countries and even for a single country they change in time. For example, a time zone "Europe/Prague", on January 1, 2022 is the offset to add to the date for getting UTC -60 minutes:
And on June 1, 2022 is the offset to add to the date for getting UTC -120 minutes:
Generally, if you want to get a time zone offset, get the time zone and the day and after you compute the time in the particular time zone by
You will get the count of minutes, which you need to add to the local time to get the corresponding UTC time. If you want to get the offset, which you usually see in printed dates, multiply it with |
Is it possible to add a filter on the returned list, so that the deprecated timezones are not included?
The text was updated successfully, but these errors were encountered: