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

PowerTip: Find How Many Days Are in a Month

$
0
0

Summary: Figure out how many days are in a month by using Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find how many days are in a particular month?

Hey, Scripting Guy! Answer Use the DaysInMonth static method from the System.DateTime object.
            It expects the year and then the month as arguments. Here are a couple examples:

Days in October 2014:

[datetime]::DaysInMonth(14,10)

Days in February 2015:

[datetime]::DaysInMonth(2015,2)


Viewing all articles
Browse latest Browse all 3333

Trending Articles