format
Learn how to use the format function in Notion formulas.
The
format()
function formats its argument as a string. It accepts all data types, including dates, Booleans, numbers, and even strings.1
format(number)
2
format(Boolean)
3
format(date)
4
format(string)
format()
is very useful for converting data types within Notion formulas.Good to know: Notion formulas can only output a single data type, and comparison operators can only compare data that share the same type.
1
format(4) // Output: 4 (as a string)
2
3
format(5+5) // Output: 10 (as a string)
4
5
format(true) // Output: true (as a string)
6
7
format(5>4) // Output: true (as a string)
8
9
format(now()) // Output: June 20, 2022 2:23 PM (changes with now()'s value)
10
11
"There are " + format(10) + " Straw Hat members."
12
// Output: There are 10 Straw Hat members.
This example database uses the
format()
function to output a string stating the age of each character.
1
// Compressed
2
"⏳ " + prop("Name") + " is " + format(dateBetween(now(), prop("Birthday"), "years")) + " years old."
3
4
// Expanded
5
"⏳ " +
6
prop("Name") +
7
" is " +
8
format(
9
dateBetween(
10
now(),
11
prop("Birthday"),
12
"years"
13
)
14
) +
15
" years old."
This formula outputs a sentence stating how old each character is based on their birthday.
To obtain the character’s age, we use the dateBetween function to find the number of years between now and the character’s birthday.
dateBetween()
returns a number, so we use the format()
function to convert it to a string.Note: To keep thinks simple, this example formula doesn't use conditional logic to determine whether the string should output "year" or "years" (accounting for plurality). To see an example that does, check out the length function.
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