<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a5a1e3ce-00fa-46e4-9a75-58c2aed9e8ce/Notion_Fundamentals_with_Thomas_Frank_-_Avatar_2021.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a5a1e3ce-00fa-46e4-9a75-58c2aed9e8ce/Notion_Fundamentals_with_Thomas_Frank_-_Avatar_2021.png" width="40px" /> 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.
Created by Thomas Frank | Learn Notion Formulas | Notion Basics | Templates | Twitter
</aside>
Hard-Coded Date (Specific Year)
// 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"
)