This question comes from a reader of the Notion course. It has been organized and shared here. If you encounter similar issues while using Notion, feel free to leave a comment.
Reader's Question
Can the task dates in a database be automatically calculated based on the dates of all its sub-tasks? As shown below:

My Answer
You can use the Rollup property to help solve this problem.
Suppose we have built a "Project - Task" structured database like this:

The goal now is to calculate the time range of all sub-tasks on the "Project" page, achieving an effect like this:

Here is the detailed solution.
Create Rollup Properties
First, the Rollup property has a built-in date range calculation feature, so we can create two Rollup properties to calculate the "earliest date" and "latest date" of sub-tasks respectively.

Of course, you could also use a Rollup property directly to calculate the total time range of sub-tasks, but this would only calculate the time duration and cannot display it in a "Date 1 → Date 2" format.

Use the dateRange Function to Combine Dates
So we can create a Formula property and use the dateRange function to combine the "earliest date" and "latest date" together.

However, you will notice that the resulting time format is @Feb 28, 2025 00:00 → May 18, 2025 00:00, showing an unwanted 00:00. This is because all dates default to 00:00 for the time portion.
Use formatDate and parseDate to Remove Unnecessary Time
So we can first use the formatDate and parseDate functions to process the "earliest date" and "latest date", and then use dateRange to combine them.
The result looks like this:

Full formula:
dateRange(Start Time.formatDate("YYYY-MM-DD").parseDate(),End Time.formatDate("YYYY-MM-DD").parseDate())Complete Database
The complete database looks like this:

Reference Template
Reference template link: https://leon21.notion.site/Sub-item-1ad0e68aa04680cb806fff894d15f29a?pvs=4
📘 FLO.W — Notion Personal Management System
FLO.W is a Notion-based personal management template that integrates tasks, notes, projects, habits, and more, complete with comprehensive tutorials.


