<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/71eff7c5-3f40-4fd4-ad18-1965b8cd7152/Wave_Styled.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/71eff7c5-3f40-4fd4-ad18-1965b8cd7152/Wave_Styled.png" width="40px" /> Thanks for checking out this guide.

It uses Notion's default 'created time' property as the task start time but you could just switch this with a date property (as long as you include a time, along with the date in each field) and it'll work in exactly the same way.

</aside>

Work out the number of minutes or hours between two times (duration 1)

Work out the number of hours between two times

dateBetween(prop("Task End"), prop("Task Start"), "hours")

Work out the number of minutes between two date/times

dateBetween(prop("Task End"), prop("Task Start"), "minutes")

Convert either output to text and add "h" or "m" after the number

format(dateBetween(prop("Task End"), prop("Task Start"), "hours")) + " h"

Check whether duration is less than an hour

if(dateBetween(prop("Task End"), prop("Task Start"), "minutes") < 60 , format(dateBetween(prop("Task End"), prop("Task Start"), "minutes")) + " m","")

Combined

if(dateBetween(prop("Task End"), prop("Task Start"), "minutes") < 60, format(dateBetween(prop("Task End"), prop("Task Start"), "minutes")) + " m", format(dateBetween(prop("Task End"), prop("Task Start"), "hours")) + " h, " + format(dateBetween(prop("Task End"), prop("Task Start"), "minutes")) + " m")

Tasks

Work out the number of hours and remaining minutes between two times (duration 2)

Calculate the number of minutes that're left over after you've calculated the number of hours between two times

dateBetween(prop("Task End"), prop("Task Start"), "minutes") - floor(dateBetween(prop("Task End"), prop("Task Start"), "minutes") / 60) * 60

Combined

Combining the previous formula with the formatted hours calculation.

if(dateBetween(prop("Task End"), prop("Task Start"), "minutes") < 60 , format(dateBetween(prop("Task End"), prop("Task Start"), "minutes")) + " m", format(dateBetween(prop("Task End"), prop("Task Start"), "hours")) + " h " + format(dateBetween(prop("Task End"), prop("Task Start"), "minutes") - floor(dateBetween(prop("Task End"), prop("Task Start"), "minutes") / 60) * 60) + " m" )