# now

Learn how to use the now function in Notion formulas.
The `now()` function returns the current date and time in your local timezone. `now()` accepts no arguments.
1
now()
now() and fromTimestamp are the only functions that will allow you to add a true date object into a formula without pulling from a Date property. To "hard-code" other dates into a formula, use the methods described below.

## Example Formula

1
now() // Output: June 23, 2022 12:30 PM (at time of writing)

### Get the Current Date Without the Time

Use the following formula to remove the current time from `now()`:
1
dateSubtract(dateSubtract(now(), minute(now()), "minutes"), hour(now()), "hours")
Here’s why you might want to do this:
When doing date math operations (e.g. dateAdd/dateSubtract) in Notion, `now()` can cause problems due to its inclusion of the current time.
Take this formula as an example:
1
// Assume Date's current value is June 30, and now() is June 23
2
dateBetween(prop("Date"), now(), "weeks")
If it’s currently June 23, and the value of the Date property is June 30, then this formula should return `1`. June 30 is 7 days out from June 23, hence one week.
However, this formula will actually return `0` because the values that are implicitly being compared are `June 23, 2022 1:35 PM` and `June 30, 2022 12:00 AM`.
As a result, the gap between the two dates is not 7 full days.
In Notion, dates without times given a default (and normally hidden) time of `00:00`, aka `12:00 AM`.
However, the `now()` function always includes the time. There’s no argument that allows you to customize its output so that it only returns the date.
To do that, you need to use the formula shown at the top of this section: `dateSubtract(dateSubtract(now(), minute(now()), "minutes"), hour(now()), "hours")`.
This uses the dateSubtract function to subtract `now()`'s current minute and hour values from `now()` itself, resulting in a date object that contains the current date with a time of `00:00`.

### Use now() to “Hard-Code” a Specific Date in a Notion Formula

If you want to hard-code a specific date into a Notion formula (i.e. June 4, 2022 12:00 AM MDT), the primary method you’d use to do that would be the fromTimestamp function.
However, fromTimestamp is mainly used to get an exact date. What if you want to hard-code a date that repeats every year, such as June 4?
You can use the `now()` function to do that with the following formula:
1
// Compressed
2
dateAdd(dateAdd(dateSubtract(dateSubtract(dateSubtract(dateSubtract(now(), minute(now()), "minutes"), hour(now()), "hours"), date(now()) - 1, "days"), month(now()), "months"), 5, "months"), 3, "days")
3
4
// Expanded
5
6
7
dateSubtract(
8
dateSubtract(
9
dateSubtract(
10
dateSubtract(
11
now(),
12
minute(
13
now()
14
),
15
"minutes"
16
),
17
hour(
18
now()
19
),
20
"hours"
21
),
22
date(
23
now()
24
) - 1,
25
"days"
26
),
27
month(
28
now()
29
),
30
"months"
31
),
32
5,
33
"months"
34
),
35
3,
36
"days"
37
)
This formula works by first using dateSubtract several times to get a date object set at the first date of the year, `January 1, 12:00 AM`.
1
// Compressed
2
dateSubtract(dateSubtract(dateSubtract(dateSubtract(now(), minute(now()), "minutes"), hour(now()), "hours"),date(now())-1,"days"),month(now()),"months")
3
4
// Expanded
5
dateSubtract(
6
dateSubtract(
7
dateSubtract(
8
dateSubtract(
9
now(),
10
minute(
11
now()
12
),
13
"minutes"
14
),
15
hour(
16
now()
17
),
18
"hours"
19
),
20
date(
21
now()
22
) - 1,
23
"days"
24
),
25
month(
26
now()
27
),
28
"months"
29
)
Next, we use two instances of dateAdd to add the correct number of months and days to January 1:
1
// "January 1" is used here to represent the previous dateSubtract() chain
2
// from the code block above. This code will not actually
3
// work in Notion's formula editor.
4

## Example Database

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. ### "Date" Property Formula

1
// Compressed
2
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")
3
4
// Expanded
5
6
7
dateSubtract(
8
dateSubtract(
9
dateSubtract(
10
dateSubtract(
11
now(),
12
minute(
13
now()
14
),
15
"minutes"
16
),
17
hour(
18
now()
19
),
20
"hours"
21
),
22
date(
23
now()
24
) - 1,
25
"days"
26
),
27
month(
28
now()
29
),
30
"months"
31
),
32
toNumber(
33
replace(
34
replace(
35
replace(
36
replace(
37
replace(
38
replace(
39
replace(
40
replace(
41
replace(
42
replace(
43
replace(
44
replace(
45
prop("Month"),
46
"January",
47
"0"
48
),
49
"February",
50
"1"
51
),
52
"March",
53
"2"
54
),
55
"April",
56
"3"
57
),
58
"May",
59
"4"
60
),
61
"June",
62
"5"
63
),
64
"July",
65
"6"
66
),
67
"August",
68
"7"
69
),
70
"September",
71
"8"
72
),
73
"October",
74
"9"
75
),
76
"November",
77
"10"
78
),
79
"December",
80
"11"
81
)
82
),
83
"months"
84
),
85
prop("Day")-1,
86
"days"
87
)
This example builds on the "hard-code" examples shown above.
Instead of hard-coding a specific date, the formula allows user input via a Select property (Month) and a Number property (Day). This allows the user to select their own specific date, which is still not tied to any particular year. The chosen month/day date will always contain the current year.
To set the month, the replace function is used (many times) to replace the chosen month's text string with its corresponding month value (0-11). This replacement number is then turned into an actual number via the toNumber function.

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