Powershell Tip #102: Get the first and last day of the month By powershellgu | July 20, 2016 3 Comments 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)
Pingback: Powershell Tip #103: Get current time UTC | Powershell Guru
Pingback: Powershell Tip #103: Get current time UTC | Powershell Guru
Pingback: Powershell Tip #101: Run a command from the history - Powershell Guru