Learn how to use the day function in Notion formulas.

The day() function returns an integer (number) between 0 and 6 that corresponds to the day of the week of its date argument:

  • 1 = Sunday
  • 2 = Monday
  • 3 = Tuesday
  • 4 = Wednesday
  • 5 = Thursday
  • 6 = Friday
  • 7 = Saturday

day() (and its sibling functions minute, hour, date, week, month, and year) is useful for manipulating dates within Notion formulas.

day(now()) /* Output: 5 (when now() = June 24, 2022) */ /* Assume a property called Date with a current date of June 1, 2022 */ prop("Date").day() /* Output: 3 */

day() can be used with other functions such as dateSubtract to change the value of a date.

/* Assume the value of now() is June 24, 2022 (Friday) */ dateSubtract(now(), day(now()), "days") /* Output: June 19, 2022 (Sunday) */

You can take this concept even further to “hard-code” any date into a Notion formula. See the section on Hard-Coding Dates into Formulas within the now article for more on how to do this.

Additionally, day() in particular is useful for determining weekdays and weekends:

/* Outputs, "It's the weekend!" if now()'s day is Saturday (6) or Sunday (7) */ now().day() == 6 or now().day() == 7 ? "It's the weekend!" : "It's a weekday." /* This can also be accomplished like so: */ now().day().test("[67]") ? "It's the weekend!" : "It's a weekday."

This example database finds the number of weekend days between two dates. If the starting and/or ending date is a weekend day, it is included in the count.

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
floor( ( prop("Days Between") + day( prop("Date 1") ) ) / 7 ) * 2 + if( day( prop("Date 1") ) == 0, 1, 0 ) - if( day( prop("Date 2") ) == 6, 1, 0 )

Let’s first cover the logic behind this formula:

First, we get the number of weekend days between our two dates, ignoring half-weekends. A half-weekend in the count occurs if:

  • Date 1 (Start date) is Sunday
  • Date 2 (End date) is Saturday

Then, to account for half-weekends, we run the following checks:

  • If Date 1 is Sunday, we add 1.
  • If Date 2 is Saturday, we subtract 1.

Now let’s talk about the formula.

To get the first count, which only counts full weekends, we find the number of days between Date 1 and Date 2 (stored in the Days Between property), and add to it the day() integer returned from Date 1.

We divide that number by 7, then remove the trailing decimals by passing it through the floor function. We then multiply by 2, since there are two days per weekend:

floor( ( prop("Days Between") + day( prop("Date 1") ) ) / 7 ) * 2

Note the use of parentheses here, which ensures the operations are carried out in the order we’ve specified above. To fully understand order of operations in Notion formulas, check out the operator precedence page.

Next, we check if Date 1 is Sunday, and if so, add 1:

if(day(prop("Date 1")) == 7, 1, 0)

Finally, we check if Date 1 is Saturday, and if so, subtract 1:

if(day(prop("Date 2")) == 6, 1, 0)

Credit is due to IBM; I found the solution to this problem in their documentation for their Cognos Business Intelligence Platform:

Calculate the number of Weekdays between two dates
How do you calculater the number of weekdays between two days?

Other formula components used in this example:

floor – Thomas Frank
add – Thomas Frank
divide – Thomas Frank
multiply – Thomas Frank
equal – Thomas Frank
subtract – Thomas Frank
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