If you’re working with dates in PowerShell, one of the most common tasks you might need to perform is adding days to a specific date. In this tutorial, I will explain how to add days to a date in PowerShell with examples.
To add days to a date in PowerShell, you can use the AddDays method of the DateTime object. For instance, to add 10 days to the current date, you can use the command $NewDate = (Get-Date).AddDays(10). This will return a new DateTime object representing the date 10 days from today, without altering the original date.
Add Days to a Date in PowerShell
In PowerShell, dates are handled using the DateTime object. To add days to a date, you can use the AddDays method, which is a part of the DateTime object.
Syntax
The syntax for adding days to a date in PowerShell is straightforward:
$NewDate = (Get-Date).AddDays(<NumberOfDays>)Here, <NumberOfDays> is the number of days you want to add to the current date.
The AddDays method returns a new DateTime object that is the specified number of days away from the original date. This method does not modify the original DateTime object but instead creates a new one.
Here is an example, I am adding 1 day to today’s date.
$NewDate = (Get-Date).AddDays(1)Here is the exact output you can see in the screenshot below:

This is how to add 1 day to current date in PowerShell.
Check How to Get Date Without Time in PowerShell?
PowerShell Get-Date Add Days Examples
Now, let me show you a few real examples of adding days to PowerShell Get-Date cmdlet.
Example 1: Add 10 Days to the Current Date
Suppose you want to add 10 days to today’s date. Here is the PowerShell script.
$CurrentDate = Get-Date
$NewDate = $CurrentDate.AddDays(10)
Write-Output "Current Date: $CurrentDate"
Write-Output "New Date: $NewDate"In this example, we first get the current date using Get-Date, then add 10 days to it using the AddDays method. The output will display both the current date and the new date.
You can see the exact output in the screenshot below:

Example 2: Add Days to a Specific Date
There will be scenarios where you might need to add days to a specific date.
$SpecificDate = Get-Date "2024-09-01"
$NewDate = $SpecificDate.AddDays(15)
Write-Output "Specific Date: $SpecificDate"
Write-Output "New Date: $NewDate"Here, we specify a date (2024-09-01) and add 15 days to it. This is useful when you need to calculate a future date based on a given date.
Here is the output in the screenshot below:

Check out How to Format Date in PowerShell
Example 3: Using a Variable for Days
Suppose you want to add days to date variable in PowerShell.
$DaysToAdd = 30
$NewDate = (Get-Date).AddDays($DaysToAdd)
Write-Output "New Date: $NewDate"In this example, the number of days to add is stored in a variable $DaysToAdd. This makes the script more flexible and easier to modify.
In this tutorial, I explained how to add days to date in PowerShell. I have shown how to use the AddDays() method in PowerShell to add days to today’s date. Finally, we also saw three real examples of adding days to date in PowerShell.
You may also like:
Bijay Kumar is an esteemed author and the mind behind PowerShellFAQs.com, where he shares his extensive knowledge and expertise in PowerShell, with a particular focus on SharePoint projects. Recognized for his contributions to the tech community, Bijay has been honored with the prestigious Microsoft MVP award. With over 15 years of experience in the software industry, he has a rich professional background, having worked with industry giants such as HP and TCS. His insights and guidance have made him a respected figure in the world of software development and administration. Read more.