formatDate

Learn how to use the formatDate function in Notion formulas.

The formatDate() function formats a date as a string using various formatting tokens.

formatDate(date, string [must conform to token format])

It accepts two arguments in the following order:

  1. A date (can be passed via properties – Date, Created Time, Last Edited Time – or via date functions such as now, fromTimestamp, dateAdd, dateSubtract)
  2. A string specifying the formatting tokens for the date output
formatDate(now(), "MMMM DD YYYY") // Output: June 24 2022 formatDate(now(), "dddd, MMMM DD, YYYY hh:mm A zz") // Output: Friday, June 24, 2022 10:45 AM MDT

You can also use brackets ([]) to escape any characters that you’d like to render explicitly (i.e. not use a formatting command):

formatDate(now(), "[Month of] MMMM, YYYY") // Output: Month of June, 2022

By specifying the formatting options you want within the function’s second argument, you can customize your date format.

Notion uses Luxon to handle date formatting, but retains a lot of the tokens used by Luxon’s predecessor, Moment. Refer to the token lists below to see all possible formatting options.

formatDate() returns a string, not a date. Therefore, it is not possible to do date math on its output.

Good to Remember: Notion formulas are picky about data types. The formula editor will almost never do automatic type conversion, so you must pass the correct data types when you use functions.

For example, you cannot use dateAdd or dateSubtract on the output of formatDate():

// ERROR: Type mismatch formatDate(now(), "MMMM DD YYYY") is not a Date. dateAdd(formatDate(now(),"MMMM DD YYYY"),4,"months")

It is also very difficult to perform date comparisons using the output of formatDate(). While equality comparisons work well:

formatDate(now(), "MMM DD YYYY") == formatDate(prop("Date"), "MMM DD YYYY")

…it is much more difficult to perform “earlier than” or “later than” comparisons.

Therefore, it is recommended to use functions such as timestamp, date, month, year, etc. to make these kinds of comparisons.

It is also not possible to create date-based filters in a database view using a formula property that outputs a date string via formatDate().

However, it is possible to work with the output of formatDate() using the Notion API.

For an example, see this recurring tasks tutorial that uses Make.com and the Notion API to parse the output of formatDate():

The Best Way to Create Recurring Tasks in Notion (2023)
Learn how to add recurring tasks to Notion and completely automate them (for free) in this step-by-step tutorial.
thomasjfrank.com

This example database shows the numbered week of year that matches the date in the Date property.

Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.
A new tool that blends your everyday work apps into one. It’s the all-in-one workspace for you and your team
thomasfrank.notion.site
formatDate(prop("Date"), "wo")
formatDate(prop("Date"), "dddd, MMMM Do, YYYY, HH:mm A, wo [week of the year]")
Token Description Example
A Uppercase meridiem PM
a Meridiem pm
H Hour in 24-hour time, no padding 4
HH Hour in 24-hour time, padded to 2 04
h Hour in 12-hour time, no padding 4
hh Hour in 12-hour time, padded to 2 04
k 1-based hour in 24-hour time, no padding 4
kk 1-based hour in 24-hour time, padded to 2 04
m Minute, no padding 8
mm Minute, padded to 2 08
s Second, no padding * 0
ss Second, padded to 2 * 00
S Fractional seconds, between 0 and 9 * 0
SS Fractional seconds, between 0 and 99, padded to 2 * 00
SSS Fractional seconds, between 0 and 999, padded to 3 * 000
LT Localized 12-hour time (no padding), uppercase meridiem 4:08 PM
LTS Localized 12-hour time with seconds (no padding), uppercase meridiem * 4:08:00 PM
* While these tokens do get parsed, Notion only displays time to the minute, so seconds will always be displayed as 0.
Token Description Example
D Day of month, no padding 21
Do Day of month, with ordinal suffix 21st
DD Day of month, padded to 2 21
DDD Day of year, no padding 294
DDDo Day of year, with ordinal suffix 294th
DDDD Day of year, padded to 3 294
d Zero-based day of week, no padding 3
do Zero-based day of week, with ordinal suffix 3rd
dd Localized day of week name, 2-letter abbreviation We
ddd Localized day of week name, 3-letter abbreviation Wed
dddd Localized day of week name, unabbreviated Wednesday
E ISO day of week, no padding 3
e Localized day of week, no padding 3
Token Description Example
w Week of year, no padding 4
wo Week of year, with ordinal suffix 4th
ww Week of year, padded to 2 04
W ISO week of year, no padding 4
Wo ISO week of year, with ordinal suffix 4th
WW ISO week of year, padded to 2 04
Token Description Example
M Month, no padding 4
Mo Month, with ordinal suffix 4th
MM Month, padded to 2 04
MMM Localized month name, 3-letter abbreviation Oct
MMMM Localized month name, unabbreviated October
Token Description Example
Q Quarter, no padding 4
Qo Quarter, with ordinal suffix 4th
QQ Quarter, padded to 2 04
Token Description Example
Y ISO year 2015
YY Year, 2 digits 15
YYYY Year, 4 digits 2015
YYYYYY Expanded year +002015
gg Week year, 2 digits 15
gggg Week year, 4 digits 2015
GG ISO week year, 2 digits 15
GGGG ISO week year, 4 digits 2015
Token Description Example
X Unix timestamp 1445468880
x Unix millisecond timestamp 1445468880000
Token Description Example
Z Time zone, short offset -07:00
ZZ Time zone, techie offset -0700
ZZZ Time zone, unabbreviated named offset Pacific Daylight Time
Token Description Example
L Localized month (padded to 2), day of month (padded to 2), year (4 digits) 10/21/2015
l Localized month (no padding), day of month (no padding), year (4-digits) 10/21/2015
LL Localized month name (unabbreviated), day of month (no padding), year (4-digits) October 21, 2015
ll Localized month name (3-letter abbreviation), day of month (no padding), year (4-digits) Oct 21, 2015
LLL Localized month name (unabbreviated), day of month (no padding), year (4-digits), 12-hour time (no padding), uppercase meridiem October 21, 2015 4:08 PM
lll Localized month name (3-letter abbreviation), day of month (no padding), year (4-digits), 12-hour time (no padding), uppercase meridiem Oct 21, 2015 4:08 PM
LLLL Localized day of week name (unabbreviated), month name (unabbreviated), day of month (no padding), year (4-digits), time (no padding) Wednesday, October 21, 2015 4:08 PM
llll Localized day of week name (3-letter abbreviation), month name (3-letter abbreviation), day of month (no padding), year (4-digits), time (no padding) Wed, Oct 21, 2015 4:08 PM
Token Description Example
[Great Scott!] Escaped characters (between square brackets) Great Scott!
About the Author

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.

🤔 Have an UB Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas

🤔 Have a Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas