# date

Learn how to use the date function in Notion formulas.

1

date(date)

1

date(now()) // Output: 24 (when now() = June 24, 2022)

2

3

// Assume a propety called Date with a current date of June 1, 2022 11:29 AM

4

date(prop("Date")) // Output: 1

1

// Assume the value of now() is June 24, 2022

2

dateSubtract(now(),date(now())-1,"days")

3

// Output: June 1, 2022

Note that since the lowest integer value of

`date()`

is `1`

, I have to use `date(now())-1`

to get the first day of the month.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.

This example database takes a date from the Date property and returns both the first and last day of the month that contains that date.

1

// Compressed

2

dateSubtract(prop("Date"), date(prop("Date")) - 1, "days")

3

4

// Expanded

5

dateSubtract(

6

prop("Date"),

7

date(

8

prop("Date")

9

) - 1,

10

"days"

11

)

To get the first day of the month, we simple subtract the

`date()`

integer (minus one) of the Date property from the Date property itself. We have to subtract one from the `date()`

output in order to get to the 1st of the month - there's no 0th day of the month!1

// Compressed

2

dateSubtract(dateAdd(prop("Date"), 1, "months"), date(prop("Date")), "days")

3

4

// Expanded

5

dateSubtract(

6

dateAdd(

7

prop("Date"),

8

1,

9

"months"

10

),

11

date(

12

prop("Date")

13

),

14

"days"

15

)

The end of the month is a variable number. Some months have 31 days, some have 30, and one has 28... sometimes.

To solve for this, we first use dateAdd to add one month to Date property's date. Then, we do the exact same

`date()`

subtraction operation described in the "First Day of the Month" section.However, this time we

*don't*subtract one from`date()`

's output, as we want to go one day further backwards from the 1st of the month. 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.

Last modified 4mo ago