Calculate Days Between Start and End Date in Notion
In this article
Notion's date properties can automatically calculate the number of days between a start and end date, which is useful for tracking project timelines, trip lengths, or task durations. This guide shows you how to create a formula that returns the exact day count, and how to handle common pitfalls like empty dates or time-based discrepancies.
What You'll Need
- A Notion workspace with a database (table, board, or list) that has two date properties: one for the start date and one for the end date.
- Access to edit the database properties (you need to be able to add a formula property).
Step-by-Step
- Open your database in Notion. Click on the database page or open it as a full page so you can see the property options.
- Add a new property by clicking the "+" button in the top-right of the database view (or the last column header). Name it something like "Days Between" or "Duration (days)".
- Change the property type to Formula. In the property settings, click on the type dropdown (currently showing "Text" or whatever default) and select Formula.
- Click on the formula field to open the formula editor. You'll see a text area where you can type the expression.
- Enter the basic formula:
dateBetween(end, start, "days"). Replaceendandstartwith the actual names of your date properties. For example, if your properties are called "Due Date" and "Start Date", typedateBetween(prop("Due Date"), prop("Start Date"), "days"). - Click anywhere outside the formula editor (or press Enter) to save the formula. Notion will automatically calculate the difference for each row.
- Check the result. If your start date is January 1 and end date is January 3, the formula should return
2(because it counts full days between, not inclusive of both endpoints). If you want to include the end day, add+ 1to the formula:dateBetween(...) + 1.
Common Mistakes
- Using the wrong property names: The property names in the formula must match exactly, including capitalization and spaces. If you have a space in the property name, you must wrap it in quotes:
prop("End Date"). - Forgetting the time component: If your date properties include times, the formula counts whole days based on the time difference. For example, from Jan 1 at 10:00 AM to Jan 2 at 9:00 AM returns 0 because it's less than 24 hours. To ignore time and count calendar days, use
dateBetween(end, start, "days")which actually ignores time and counts date boundaries, so it works as expected. But if you useend - start(which gives milliseconds), you'll get fractional days. - Empty date fields: If either date is empty, the formula returns an error or blank. You'll need to add an
ifstatement to handle that (see Troubleshooting). - End date before start date: The formula returns a negative number. Decide whether that's acceptable or wrap it in
abs()to get a positive difference.
Tips
- Use the "days" unit in the formula to get a whole number. You can also use "hours", "minutes", etc., but for days, stick with "days".
- Combine with other formulas: You can use the result in other calculations, like multiplying by a daily rate to get cost.
- Format the output: If you want to add text, use
format():format(dateBetween(...)) + " days". - Handle empty dates gracefully: Use
if(empty(prop("End Date")), "", dateBetween(...))to show a blank instead of an error.
Troubleshooting
- Formula shows an error like "Invalid formula": Double-check property names and syntax. Ensure you have
prop("Property Name")exactly. Also, make sure you're not missing a comma or parenthesis. - Result is blank for some rows: This usually means one of the date fields is empty. Wrap the formula in an
ifstatement:if(empty(prop("Start Date")), "", if(empty(prop("End Date")), "", dateBetween(...))). - Result is a negative number: Your end date is before your start date. If you want the absolute difference, use
abs(dateBetween(...)). - Result is a decimal (like 1.5): This happens if you used the minus operator (
-) instead ofdateBetween. The minus operator returns milliseconds; you need to convert to days by dividing by 86400000. But better to usedateBetween. - Result doesn't update when I change dates: Notion formulas recalculate automatically, but if you're editing the formula itself, make sure you click outside the editor to save. Also, check that the property is actually a formula type, not a text property.
Frequently Asked Questions
Does the formula count the start day?
No, dateBetween counts the number of full days between the two dates. For example, from Jan 1 to Jan 3 gives 2. If you want to include the start day, add + 1.
Can I calculate days from today to a date?
Yes, use dateBetween(prop("Due Date"), now(), "days") to get the number of days from today to the due date. Note that now() includes the current time, so it may give a fractional result if you don't round.
How do I show the result as "X days"?
Use format(dateBetween(...)) + " days". For example: format(dateBetween(prop("End"), prop("Start"), "days")) + " days".
What if my dates are in different properties across two databases?
You can use relation() and rollup() to pull dates from a related database, but that's more complex. For a simple calculation, keep both dates in the same database.
Can I use this in a calendar view?
Yes, the formula property works in any view. You can display it as a column in a calendar view, but the formula itself doesn't affect the calendar layout.
Why does my formula return a negative number?
Because your end date is before your start date. Notion returns the signed difference. Use abs() to get a positive number, or reorder your dates.