Top community members
All Wiki Articles Create Wiki Article

Welcome to Dirask IT community! ❤ 💻
We are community of people that helps each other.

If you think you have some skills to help others

help someone and become a part of our community - List Q & A

C# / .NET - current time zone offset

0 contributions
13 points

In C# / .NET it is possible to get time zone with TimeZoneInfo class.

1. TimeZoneInfo class example

TimeZoneInfo zone = TimeZoneInfo.Local;

Console.WriteLine(zone.DisplayName);
Console.WriteLine(zone.BaseUtcOffset);

Output:

(UTC+00:00) Dublin, Edinburgh, Lisbon, London
00:00:00
Notes:
  • Example has been run from London in United Kingdom.
  • Do not use TimeZone class because is obsolete.
  • TimeZoneInfo.BaseUtcOffset property returns difference between current time and UTC.

References

  1. TimeZoneInfo Class - Microsoft Docs
  2. Coordinated Universal Time (UTC) - Wikipedia

Merged questions

  • C# / .NET - get current timezone
0 contributions

Suggested wiki articles:

Suggested findings

Let's do the work and have some fun
  • Dirask is online IT community for professionals and hobbyist to share their knowledge and help each other in extraordinary easy way. ❤ 💻 🙂
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    we will help you. 👍 ✔ 🦄
Read more