Forum Discussion
tehatchKFI
Sep 28, 2023Copper Contributor
Get-date AddDays Method Not Returning a Value
I have an unusual one. The AddDays method of Get-Date isn't returning a value on my computer. It's not working in PowerShell 5 or 7. Get-date by itself works find and returns today's date. PS...
- Sep 28, 2023
In line six of your original post, you have made a small syntax mistake, which is why it returns nothing.
From line 6, this:
(get-date).AddDays.(-30)
Should have been this (note the removal of the period prior to the "(-30)"):
(get-date).AddDays(-30)
Cheers,
Lain
tehatchKFI
Copper Contributor
Yep, even rebooted, it's working fine now.
Sep 28, 2023
Good to hear, please mark my answer as solution to mark it as solved