Date.AddDays
Adds a number of days to a date, or subtracts them when the number is negative.
Date.AddDays(dateOrDateTime as any, numberOfDays as number) as anyReturns: The new date, or null when the input is null.
What it does
Date.AddDays moves a date forward or back by a number of days. The main finance use is a due date: an invoice dated on a given day with net 30 terms is due 30 days later. It is a simple, exact calculation, with no month rules involved.
Syntax and arguments
- dateOrDateTime: the starting date or datetime.
- numberOfDays: the number of days to add. Use a negative number to go back.
Example
A vendor invoice is dated September 15, 2026, with net 30 payment terms. The due date and the date that is 10 days before the due date for an early payment discount are both calculated.
let
InvoiceDate = #date(2026, 9, 15),
DueDate = Date.AddDays(InvoiceDate, 30),
DiscountDate = Date.AddDays(DueDate, -10)
in
{DueDate, DiscountDate}
The due date is October 15, 2026, because September has 30 days. The early payment date is October 5, 2026. The calculation is the same for every invoice, so one rule covers the whole list.
Example: a second, different use
Create a list of dates for the next 14 days for a cash forecast, by adding one day at a time to a start date.
Things to watch
- Days are calendar days. A "net 30 business days" rule needs a different calculation that skips weekends and holidays.
- Date.AddDays on a datetime keeps the time part.
- For an end of month due date, use Date.EndOfMonth instead.
- Null in gives null out.
In business terms
Payment due dates, discount deadlines, lease notice periods and warranty windows are all counted in days. A consistent day count is what makes a payables aging and a cash forecast agree with the contract terms.