1

#PSTip Enumerate Time Zones that support day light savings

I was recently working on WPF based UI for one of my PowerShell modules and in the process, I had to figure out a way to find out if a selected timezone supports day light savings or not. I’d initially looked at System.TimeZone .NET class but could not find any relevant method or property.

The GetSystemTimeZones() method in System.TimeZoneInfo class was what I really needed. This method returns a set of time zones available on the local system and this includes a property called SupportsDayLightSavingTime property. We can use this property to filter out what we need!

[System.TimeZoneInfo]::GetSystemTimeZones() | Where { $_.SupportsDayLightSavingTime }
Filed in: Columns, Tips and Tricks Tags: , , , ,

One Response to "#PSTip Enumerate Time Zones that support day light savings"

Leave a Reply

Submit Comment

© 2016 PowerShell Magazine. All rights reserved. XHTML / CSS Valid.
Proudly designed by Theme Junkie.
%d bloggers like this: