Last active
August 29, 2015 14:03
-
-
Save avenet/51ccca92fb98001b4977 to your computer and use it in GitHub Desktop.
Retrieves the local offset hours based on the current date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Avenet.Utils | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine(GetLocalOffsetHours()); | |
} | |
private static int GetLocalOffsetHours() | |
{ | |
TimeZone localZone = TimeZone.CurrentTimeZone; | |
var offset = localZone.GetUtcOffset(DateTime.Now); | |
return offset.Hours; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment