Skip to content

Instantly share code, notes, and snippets.

@RhysC
Created November 29, 2012 09:34
Show Gist options
  • Save RhysC/4167816 to your computer and use it in GitHub Desktop.
Save RhysC/4167816 to your computer and use it in GitHub Desktop.
Time zones for relevant States
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