PowerShell : What the date x hours/days ahead or behind?

 If you want to work out that date a specified number of  unit in the future or past try this:

Add 5 hours : (Get-Date).AddHours(5)

Add 5 days: (Get-Date).adddays(5)

Minus 5 hours: (Get-Date).AddHours(-5)

Minus 5 days: (Get-Date).AddDays(-5)

Previous Post Next Post

☕️ Buy me a coffee ?

If any of these articles have helped you out consider buying me a coffee, completely optional, but would be appreciated!

نموذج الاتصال