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

Date and time types use UTC instead of the user's time zone #167

Open
rpetrusha opened this issue Mar 12, 2019 · 0 comments
Open

Date and time types use UTC instead of the user's time zone #167

rpetrusha opened this issue Mar 12, 2019 · 0 comments

Comments

@rpetrusha
Copy link

Date and time types use UTC instead of the user's time zone

Related to #92, #149, dotnet/docs#10296

Consider the following code:

Console.WriteLine($"It is now {DateTime.Now} local time.");
Console.WriteLine($"It is now {DateTime.UtcNow} UTC.");
Console.WriteLine($"Your time zone is {TimeZoneInfo.Local.DisplayName}.");

When run interactively, it produces the following output:

It is now 03/12/2019 16:11:47 local time.
It is now 03/12/2019 16:11:47 UTC.
Your time zone is UTC.

When run on my local system, it produces the following output:

It is now 3/12/2019 9:11:37 AM local time.
It is now 3/12/2019 4:11:37 PM UTC.
Your time zone is (UTC-08:00) Pacific Time (US & Canada).

UTC appears to be used by default as the user's local time zone rather, and the UTC offset available from the user's browser is not used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant