PowerTip: Find How Many Days Are in a Month

Doctor Scripto

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:


Days in February 2015:



Discussion is closed.

Feedback usabilla icon