Skip to content

{ Category Archives } timezones

LINQ mucking

Another quick one! Forcing myself to learn LINQ, so I decided to rewrite some looping code. The original code; simple enough, loop thru all the daylight adjustments for a timezone and build a list of date/time and offset. List<TransitionOffset> transitions = new List<TransitionOffset>(); foreach (TimeZoneInfo.AdjustmentRule adj in TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time").GetAdjustmentRules()) { if (adj.DateEnd.Year >= […]

Converting Timezones in .net

Ever had the need to convert a date/time to another timezone? I had to do it a while back to display publishing deadlines for a website used in Australia and New Zealand. Back then I used a wrapper for the kernel32 function SystemTimeToTzSpecificLocalTime from the CodeProject article Convert between UTC (Universal Co-ordinated Time) and local […]