Finding Days in Month

If you need to determine the days in a given month, you can use the static DaysInMonth() function provided by the DateTime type. As you can see, the days in a month are not always the same for every year:

[DateTime]::DaysInMonth(2009, 2)
28
[DateTime]::DaysInMonth(2008, 2)
29

Twitter This Tip! ReTweet this Tip!


Posted Sep 16 2010, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.