PowerShell for Windows Admins

Oct 31 2010   4:29AM GMT

Daylight Saving Time?



Posted by: Richard Siddaway
Tags:
Operating System

 

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

001
002
003
004
$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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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: