Created
November 29, 2012 09:34
-
-
Save RhysC/4167816 to your computer and use it in GitHub Desktop.
Time zones for relevant States
This file contains 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
var dt = DateTime.UtcNow; | |
var utcOffset = new DateTimeOffset(dt, TimeSpan.Zero); | |
//TimeZoneInfo.GetSystemTimeZones() - provides timezone identifiers | |
(from t in new []{ | |
new {Name = "UK", TimeZoneId= "GMT Standard Time"}, | |
new {Name = "WA", TimeZoneId= "W. Australia Standard Time"}, | |
new {Name = "NT", TimeZoneId= "AUS Central Standard Time"}, | |
new {Name = "NSW", TimeZoneId= "E. Australia Standard Time"}, | |
new {Name = "VIC", TimeZoneId= "E. Australia Standard Time"}, | |
new {Name = "ACT", TimeZoneId= "E. Australia Standard Time"}, | |
new {Name = "TAS", TimeZoneId= "Tasmania Standard Time"}, | |
new {Name = "QLD", TimeZoneId= "AUS Eastern Standard Time"} | |
} | |
let time = utcOffset.ToOffset(TimeZoneInfo.FindSystemTimeZoneById(t.TimeZoneId).GetUtcOffset(utcOffset)) | |
select new { | |
Jurisdiction = t.Name, | |
LocalDate = time.ToString("dd MMM"), | |
LocalTime = time.ToString("HH:mm") | |
}).Dump(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment