<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 example database below shows how you can “hard-code” dates into a Notion formula using the now()
function along with dateAdd and dateSubtract. The Date property outputs a date that matches the choices set in the Month and Day properties.
Created by Thomas Frank | Learn Notion Formulas | Notion Basics | Templates | Twitter
</aside>
// Compressed
dateAdd(dateAdd(dateSubtract(dateSubtract(dateSubtract(dateSubtract(now(), minute(now()), "minutes"), hour(now()), "hours"), date(now()) - 1, "days"), month(now()), "months"), 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")
// Expanded
dateAdd(
dateAdd(
dateSubtract(
dateSubtract(
dateSubtract(
dateSubtract(
now(),
minute(
now()
),
"minutes"
),
hour(
now()
),
"hours"
),
date(
now()
) - 1,
"days"
),
month(
now()
),
"months"
),
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"
)