Skip to content
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

FindSystemTimeZoneById doesn't support "Eastern Standard Time" on Ubuntu #16871

Closed
gkhanna79 opened this issue Mar 8, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@gkhanna79
Copy link
Member

commented Mar 8, 2017

@AlexHankins commented on Wed Mar 08 2017

Method: System.TimeZoneInfo.FindSystemTimeZoneById

According to Time Zone IDs (Compact 2013), this method would accept "Eastern Standard Time" as a parameter. However, on Ubuntu 16.04, this fails with System.TimeZoneNotFoundException: The time zone ID 'Eastern Standard Time' was not found on the local computer. ---> System.IO.FileNotFoundException: Could not find file '/usr/share/zoneinfo/Eastern Standard Time'.

Workaround:

Try the Time Zone ID. If that fails, look up by TZ database value:

            TimeZoneInfo easternTime;
            try {
                 easternTime = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
            }
            catch (Exception ex)
            {
                 easternTime = TimeZoneInfo.FindSystemTimeZoneById("US/Eastern");
            }

dotnet --info output:

dotnet --info
.NET Command Line Tools (1.0.1)

Product Information:
Version: 1.0.1
Commit SHA-1 hash: 005db40

Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/1.0.1

@gkhanna79

This comment has been minimized.

Copy link
Member Author

commented Mar 8, 2017

@tarekgh

This comment has been minimized.

Copy link
Member

commented Mar 8, 2017

#2538 and dotnet/corefxlab#338 already tracking such issues.

@tarekgh tarekgh closed this Mar 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.