Powershell Tip #102: Get the first and last day of the month By powershellgu | July 20, 2016 0 Comment Tip: You can get the first and last day of a month : PowerShell $firstDay = Get-Date -Day 1 -Hour 0 -Minute 0 -Second 0 $lastDay = ($firstDay).AddMonths(1).AddSeconds(-1) 12 $firstDay = Get-Date -Day 1 -Hour 0 -Minute 0 -Second 0$lastDay = ($firstDay).AddMonths(1).AddSeconds(-1) To get the number of days in a month : PowerShell [datetime]::DaysInMonth(2016, 08) 1 [datetime]::DaysInMonth(2016, 08)