# year

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

## Example Formulas

1
year(now()) // Output: 2022 (When now() = June 24, 2022)
2
3
// Assume a propety called Date with a current date of June 24, 2022
4
year(prop("Date")) // Output: 2022
`year()` 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(), 10, "years")
3
// Output: June 24, 2012
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 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. ### "Date" Property Formula

1
// Compressed
2
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")
3
4
// Expanded
5
6
7
8
dateSubtract(
9
dateSubtract(
10
dateSubtract(
11
dateSubtract(
12
dateSubtract(
13
now(),
14
minute(
15
now()
16
),
17
"minutes"
18
),
19
hour(
20
now()
21
),
22
"hours"
23
),
24
date(
25
now()
26
) - 1,
27
"days"
28
),
29
month(
30
now()
31
),
32
"months"
33
),
34
year(
35
now()
36
),
37
"years"
38
),
39
toNumber(
40
replace(
41
replace(
42
replace(
43
replace(
44
replace(
45
replace(
46
replace(
47
replace(
48
replace(
49
replace(
50
replace(
51
replace(
52
prop("Month"),
53
"January",
54
"0"
55
),
56
"February",
57
"1"
58
),
59
"March",
60
"2"
61
),
62
"April",
63
"3"
64
),
65
"May",
66
"4"
67
),
68
"June",
69
"5"
70
),
71
"July",
72
"6"
73
),
74
"August",
75
"7"
76
),
77
"September",
78
"8"
79
),
80
"October",
81
"9"
82
),
83
"November",
84
"10"
85
),
86
"December",
87
"11"
88
)
89
),
90
"months"
91
),
92
prop("Day")-1,
93
"days"
94
),
95
prop("Year"),
96
"years"
97
)
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.

#### Other formula components used in this example: 