Get Time Zone Info

by Aug 12, 2013

There is a little known utility called tzutil.exe which can both set the current time zone and get all available time zones. Today, let's check out how PowerShell can embrace raw output and help you get what you want.

When you dump all available time zones, you get a huge list:

Just remember that PowerShell’s operators work as filters when applied to arrays, and that anything a console-based utility like tzutil.exe returns is an array of string lines. So to find the time zone that has 'East' in its name, try this:

If you need context information (include the line following the match, for example), use Select-String instead:

Of course, tailoring console applications to your needs is only second choice. Things get much easier if the .NET Framework provides information directly:

Twitter This Tip! ReTweet this Tip!