Syntax error How to manipulate Date in PowerShell?

How to manipulate Date in PowerShell?



To add/remove date from the date string you need to use AddDay() method. For example,

We need to add 6 days to the current date.

(Get-Date).AddDays(6)
25 March 2020 22:40:36

To go back to the specific number of days, the same AddDays() method will be used but the numbers are negative.

 For example,

(Get-Date).AddDays(-6)
13 March 2020 22:45:34
Updated on: 2020-03-20T07:08:36+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements