PowerShell for Windows Admins

Oct 31 2010   4:29AM GMT

Daylight Saving Time?

Richard Siddaway Richard Siddaway Profile: Richard Siddaway


We’ve finished daylight saving time in the UK.  How can we tell which time zone (and if daylight saving is enabled)?

$tz = Get-WmiObject Win32_TimeZone
if ((Get-Date).
IsDayLightSavingTime()) {
“Time zone: $($tz.DayLightName)”}
else {“Time zone: $($tz.StandardName)”}

Use Win32_TimeZone.  The easiest way to test for daylight saving time is to use get-date as shown. depending on the results we show the relevant time zone

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: