Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to identify a leap year

$
0
0

Summary: Use PowerShell and Math to identify a leap year.

Hey, Scripting Guy! Question Is there a way to use PowerShell to identify whether this year is a leap year?

Hey, Scripting Guy! Answer Actually there is! You can use a combination of Get-date to find out the year and the Modulus function in PowerShell.

((Get-Date).year)%4

If the value is zero, the current year is a leap year!

The Doctor


Viewing all articles
Browse latest Browse all 3333

Trending Articles