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.

format(number) format(Boolean) format(date) format(string) format(list) number.format() Boolean.format() date.format() string.format() list.format()

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.
See Converting Data Types to learn all of the ways to convert data in Notion formulas.

format(4) /* Output: "4" (as a string) */ format(5+5) /* Output: "10" (as a string) */ format(true) /* Output: "true" (as a string) */ format(5>4) /* Output: "true" (as a string) */ format(now()) /* Output: "June 20, 2022 2:23 PM" (as a string, changes with now()'s value) */ /* Automatic conversion of a number to a string */ "There are " + prop("Number") + " Straw Hat members." /* Output: There are 10 Straw Hat members. */

This example database uses the format() function to output a string stating the age of each character.

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
"⏳ " + prop("Name") + " is " + dateBetween( now(), prop("Birthday"), "years" ) + " 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.

Other formula components used in this example:

dateBetween – Thomas Frank
thomasjfrank.com
now – Thomas Frank
thomasjfrank.com
add – Thomas Frank
thomasjfrank.com
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