dateAdd

Learn how to use the dateAdd function in Notion formulas.

The dateAdd() function accepts a date argument and adds to it, returning a new date.

dateAdd(date, number, string [from unit list])

date.dateAdd(number, string [from unit list])
Code language: JavaScript (javascript)

It requires three arguments in the following order:

  1. A date (must be an actual date data type)
  2. A number
  3. A unit

Accepted units include:

  • “years”
  • “quarters”
  • “months”
  • “weeks”
  • “days”
  • “hours”
  • “minutes”
  • “seconds”
  • “milliseconds”
/* Assume a property called "Date" with a current row value of June 1, 2022 */
dateAdd(prop("Date"),3,"months") /* Output: September 1, 2022 */

dateAdd(prop("Date"),5,"days") /* Output: June 6, 2022 */
Code language: JavaScript (javascript)

You can nest multiple dateAdd() functions to add multiple different types of units to a date:

/* Assume a property called "Date" with a current row value of June 1, 2022 */
dateAdd(dateAdd(prop("Date"),3,"months"),5,"days")
/* Output: September 6, 2022 */
Code language: JavaScript (javascript)

dateAdd() accepts negative values:

/* Assume a property called "Date" with a current row value of June 1, 2022 */
dateAdd(prop("Date"), -3, "months") /* Output: March 1, 2022 */
Code language: JavaScript (javascript)

This example database demonstrates a very simple way to track recurring tasks in Notion. The Next Due formula returns the next due date for the task, based on the current Due date and the number of days specified in the Interval (Days) property.

Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.
A new tool that blends your everyday work apps into one. It’s the all-in-one workspace for you and your team
thomasfrank.notion.site
// Compressed
dateAdd(prop("Due"),prop("Interval"),prop("Unit") + "s")

// Expanded
dateAdd(
    prop("Due"),
    prop("Interval"),
    prop("Unit") + "s"
)
Code language: JavaScript (javascript)

As you can see, this formula is quite simple. If you’re not worried about accounting for overdue tasks, returning the “next due” date for a recurring task is quite easy.

Using dateAdd(), all we are three pieces of information:

  • The original due date
  • The interval (a number)
  • The unit (e.g. days, weeks, months, years)

The value from the Unit property is concatenated with “s” in order to make it conform to dateAdd()‘s accepted values.

Of course, handling recurring tasks can get much more complicated if you do want to handle overdue tasks. If you want to see just how big a Notion formula can get, check out the recurring tasks formula we developed for my Ultimate Tasks and Ultimate Brain templates:

Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.
A new tool that blends your everyday work apps into one. It’s the all-in-one workspace for you and your team
thomasfrank.notion.site

Other formula components used in this example:

add – Thomas Frank
thomasjfrank.com
About the Author

My name is Thomas Frank, and I'm a Notion-certified writer, YouTuber, and template creator. I've been using Notion since 2018 to organize my personal life and to run my business and YouTube channel. In addition to this formula reference, I've created a free Notion course for beginners and several productivity-focused Notion templates. If you'd like to connect, follow me on Twitter.

🤔 Have an UB Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas

🤔 Have a Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas