month
Learn how to use the month function in Notion formulas.
The `month()` function returns an integer (number) between `0` and `11` that corresponds to the month of its date argument.
1
month(date)
`month()` (and its sibling functions minute, hour, day, date, and year) is useful for manipulating dates within Notion formulas.

# Example Formulas

1
month(now()) // Output: 5 (when now() = June 24, 2022)
2
3
// Assume a propety called Date with a current date of Jan 1, 2022
4
month(prop("Date")) // Output: 0
`month()` can be used with other functions such as dateSubtract to change the value of a date, like so:
1
// Assume the value of now() is June 24, 2022
2
dateSubtract(now(), month(now()), "months")
3
// Output: January 24, 2022
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.

# Example Database

The example database below determines each person’s next birthday based on their Birth Date, as well as the current date.
Screenshot taken Sept 1, 2022.

## View and Duplicate Database

month
College Info Geek on Notion

## "Next Birthday" Property Formula

1
// Compressed
2
dateAdd(prop("Birth Date"), year(now()) - year(prop("Birth Date")) + if(month(prop("Birth Date")) == month(now()) and date(prop("Birth Date")) >= date(now()) or month(prop("Birth Date")) > month(now()), 0, 1), "years")
3
4
// Expanded
5
6
prop("Birth Date"),
7
year(
8
now()
9
) -
10
year(
11
prop("Birth Date")
12
) +
13
if(
14
month(
15
prop("Birth Date")
16
) == month(
17
now()
18
) and date(
19
prop("Birth Date")
20
) >= date(
21
now()
22
) or month(
23
prop("Birth Date")
24
) > month(
25
now()
26
),
27
0,
28
1
29
),
30
"years"
31
)
Here's the logic behind this formula:
• Add a number of years to it using dateAdd, determined by the year output of now minus the birth year itself (E.g. 2022 - 1991 = 31).
• Determine if the person's birthday has already happened this year. If not, add one more year (since we're determining their next birthday).
To check whether or not the person's birthday has already happened, we use an if statement and multiple comparisons using comparison operators. If one of the following is true:
• The current month and the birth month are equal AND the current day of the month (determined with date) is equal to or later than the birth date's day of the month
• OR the birth month is later than the current month
...then this indicates that the person's birthday has NOT yet happened this year. Therefore, we add 0 to the count.
Otherwise, we add 1 to the count.
Good to know: The or operator has a lower operator precedence than the and operator, meaning that any "and" comparisons will be executed before the first "or" comparison.

### 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.