Languages
[Edit]
EN

C# / .NET - get timezone offset

0 points
Created by:
Marcino
720

In this article, we would like to show you how to get timezone offset in C#.

Quick solution:

TimeZoneInfo.Local.GetUtcOffset(DateTime.UtcNow);

 

Practical example

var offset = TimeZoneInfo.Local.GetUtcOffset(DateTime.UtcNow);

Console.WriteLine(offset);

Output:

01:00:00

References

  1. TimeZoneInfo.GetUtcOffset Method (System) | Microsoft Docs
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join