What is the correct way to compare DateTime's by the month in PowerShell 2.0? In the end, I want to know if the current month is July or later, between July and December. The year doesn't matter. I'm not sure if there is a switch for month specific comparisons or try to get just the month and >= 7. Thanks
I would use the PowerShell cmdlet called Get-Date.
If ((Get-Date).Month -ge 7){...}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With