year

The year() function returns an integer (number) that corresponds to the year of its date argument.

year(date)
Code language: JavaScript (javascript)

year() (and its sibling functions minutehour, daydate, and month) is useful for manipulating dates within Notion formulas.

year(now()) // Output: 2022 (When now() = June 24, 2022)

// Assume a property called Date with a current date of June 24, 2022
year(prop("Date")) // Output: 2022
Code language: JavaScript (javascript)

year() can be used with other functions such as dateSubtract to change the value of a date, like so:

// Assume the value of now() is June 24, 2022
dateSubtract(now(), 10, "years")
// Output: June 24, 2012
Code language: JavaScript (javascript)

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.

The now formula example shows how to “hard-code” a date into a Notion formula without a specific year. The example database below does the same thing, except it allows you to specify a year using a Number 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(dateAdd(dateAdd(dateSubtract(dateSubtract(dateSubtract(dateSubtract(dateSubtract(now(), minute(now()), "minutes"), hour(now()), "hours"), date(now()) - 1, "days"), month(now()), "months"), year(now()), "years"), toNumber(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(prop("Month"), "January", "0"), "February", "1"), "March", "2"), "April", "3"), "May", "4"), "June", "5"), "July", "6"), "August", "7"), "September", "8"), "October", "9"), "November", "10"), "December", "11")), "months"), prop("Day") - 1, "days"), prop("Year"), "years")

// Expanded
dateAdd(
    dateAdd(
        dateAdd(
            dateSubtract(
                dateSubtract(
                    dateSubtract(
                        dateSubtract(
                            dateSubtract(
                                now(), 
                                minute(
                                    now()
                                ), 
                                "minutes"
                            ), 
                            hour(
                                now()
                            ), 
                            "hours"
                        ), 
                        date(
                            now()
                        ) - 1, 
                        "days"
                    ), 
                    month(
                        now()
                    ), 
                    "months"
                ),
                year(
                    now()
                ),
                "years"
            ), 
            toNumber(
                replace(
                    replace(
                        replace(
                            replace(
                                replace(
                                    replace(
                                        replace(
                                            replace(
                                                replace(
                                                    replace(
                                                        replace(
                                                            replace(
                                                                prop("Month"),
                                                                "January",
                                                                "0"
                                                            ),
                                                            "February",
                                                            "1"
                                                        ),
                                                        "March",
                                                        "2"
                                                    ),
                                                    "April",
                                                    "3"
                                                ),
                                                "May",
                                                "4"
                                            ),
                                            "June",
                                            "5"
                                        ),
                                        "July",
                                        "6"
                                    ),
                                    "August",
                                    "7"
                                ),
                                "September",
                                "8"
                            ),
                            "October",
                            "9"
                        ),
                        "November",
                        "10"
                    ),
                    "December",
                    "11"
                )
            ), 
            "months"
        ), 
        prop("Day")-1, 
        "days"
    ),
    prop("Year"),
    "years"
)
Code language: JavaScript (javascript)

This formula works the same way as the formula in the now article, except we’re now adding one extra instance of dateAdd and dateSubtract. These final instances:

  • Use year() to take the current year and set it to 0.
  • Then add the specified year in the Year property.
dateAdd – Thomas Frank
thomasjfrank.com
dateSubtract – Thomas Frank
thomasjfrank.com
subtract – Thomas Frank
thomasjfrank.com
replace – Thomas Frank
thomasjfrank.com
toNumber – Thomas Frank
thomasjfrank.com
now – Thomas Frank
thomasjfrank.com
minute – Thomas Frank
thomasjfrank.com
hour – Thomas Frank
thomasjfrank.com
date – Thomas Frank
thomasjfrank.com
month – 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