Skip to content
Tutorials Center
My learning

Topics

Lesson 18 of 36 ยท Relations and Formulas

Formula Functions and Dates

Go deeper with Notion formulas: dateBetween, dateAdd, formatDate, text functions, lists with map and filter, let variables, and a deadline status example.

With the basics in place, formulas become far more useful once you use dates, text and list functions. This lesson covers the groups you will use most and ends with a realistic example: a smart deadline label.

The syntax below follows the current Notion formula language. Function names and options can be extended by Notion over time; the formula editor's autocomplete shows what your version supports. The code you can run here is a JavaScript stand-in that mimics the logic; it is not Notion.

Date functions

Dates are real date values. Useful functions:

Formula Result
now() Current date and time
today() Today's date (no time)
dateAdd(prop("Due"), 7, "days") A date 7 days later
dateSubtract(prop("Due"), 1, "weeks") A date one week earlier
dateBetween(prop("Due"), today(), "days") Days from today to Due (negative if overdue)
formatDate(prop("Due"), "MMM D, YYYY") Text like Jul 4, 2025
start(prop("Range")), end(prop("Range")) Ends of a date range
year(), month(), day(), dateRange(a, b) Parts and construction

Units include "years", "quarters", "months", "weeks", "days", "hours", "minutes". dateBetween(a, b, unit) returns a minus b, so put the later date first for a positive result.

Function families

Date dateAdd, dateBetween, formatDate.
Text contains, replace, lower, substring.
List map, filter, join, length.
Math round, min, max, abs.
1 / 2

Text functions

TEXT
contains(prop("Name"), "urgent")
lower(prop("Name"))
replace(prop("Name"), "Draft", "Final")
substring(prop("Name"), 0, 10)
length(prop("Name"))
test(prop("Email"), "@example.com$")   /* regular expression */

replace changes the first match; replaceAll changes all. join(list, ", ") combines list items into text. split(text, ",") turns text into a list.

List functions

Multi-select, Relation and Person properties return lists. Notion supports dot syntax and function syntax:

TEXT
prop("Tags").length()
prop("Tags").join(", ")
prop("Tags").map(current.lower())
prop("Tags").filter(current != "archive")
prop("Tags").includes("urgent")

Inside map and filter, current is the item being processed and index is its position. sum(prop("Hours")) adds a list of numbers, such as a rolled-up number list.

let(): naming values

let(name, value, expression) stores a value for reuse, which makes formulas shorter and easier to read:

TEXT
let(days, dateBetween(prop("Due"), today(), "days"),
  if(days < 0, "Overdue",
    if(days == 0, "Due today",
      if(days <= 3, "Soon", "On track"))))

(You can also nest lets to name several values.) Compare this with repeating the dateBetween call three times.

A deadline label

Goal: a Status column that reads Done if the checkbox is ticked, No date when Due is empty, otherwise Overdue, Due today, Soon or On track. This is the Notion formula:

TEXT
if(prop("Done"), "Done",
  if(empty(prop("Due")), "No date",
    let(days, dateBetween(prop("Due"), today(), "days"),
      ifs(days < 0, "Overdue", days == 0, "Due today", days <= 3, "Soon", "On track"))))

Here is the same logic as a JavaScript stand-in, with a fixed "today" so the output is deterministic.

JS Deadline label (stand-in)

Press Run (or Ctrl + Enter) to see the console output here.

No output.

JS List and text functions (stand-in)

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Practical advice

  1. Build formulas incrementally: get dateBetween right first, then wrap it in if.
  2. Name intermediate values with let to keep formulas readable.
  3. Remember time zones: now() includes a time, today() does not; use today() for whole-day comparisons.
  4. Use view filters for "overdue" lists rather than a formula, when you only need to hide rows. Use formulas when you need the label itself.
  5. Formulas can reference other formulas and rollups, but avoid long chains; they are hard to debug.

Older databases may still use the previous formula syntax (Formulas 1.0). Notion converts them automatically when you edit, but the function names differ slightly, so check the editor if a copied formula does not work.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does dateBetween(prop("Due"), today(), "days") return when Due is yesterday?

    It returns the first date minus the second, so a past due date gives a negative number.
  2. 2. What does let() help with?

    let(name, value, expression) defines a variable inside the formula.
  3. 3. Which function turns a list of tags into text with separators?

    join(list, separator) combines list items into one text value.
  4. 4. What is the difference between now() and today()?

    Use today() for whole-day comparisons and now() when time matters.

Summary

  • Date functions such as dateBetween, dateAdd and formatDate power deadlines and ages.
  • Text and list functions (contains, replace, map, filter, join) transform values.
  • let() names values for readable formulas.
  • Build formulas step by step and prefer view filters when you only need to hide rows.

Next: Database Templates