# Calculate the Number of Days Between Two Calendar Days | Notion Guide

Jan 21 '20 ยท 1 min read ยท 2696 views

#### Examples

NameDue DateRemaining Days
Date in previous year
Today
Tomorrow
Date this year
Date next year
• ๐ธ Examples screenshot - this is how the table looked on the date when this template was created

### Get the day number from a date

This works out how many days into the year a date is e.g. 1st February = 32.
`formatDate(prop("Due Date"), "DDD")`

### Get number of calendar days between two dates

Notion doesn't recognise the output of the `formatDate` function as a number so I've used `toNumber` to turn the output into a number.
`toNumber(formatDate(prop("Due Date"), "DDD")) - toNumber(formatDate(now(), "DDD"))`

### Adjust the calculation if the date is next year

```if(year(prop("Due Date")) > year(now()), toNumber(formatDate(prop("Due Date"), "DDD")) + 365 - toNumber(formatDate(now(), "DDD")), toNumber(formatDate(prop("Due Date"), "DDD")) - toNumber(formatDate(now(), "DDD")) )```

### Adjust the calculation if the date is last year

```if(year(prop("Due Date")) < year(now()), toNumber(formatDate(prop("Due Date"), "DDD")) - 365 - toNumber(formatDate(now(), "DDD")), toNumber(formatDate(prop("Due Date"), "DDD")) - toNumber(formatDate(now(), "DDD")) )```

### ๐ Finished Formula

This formula combines the 3 formulas from earlier in the guide.
```if(year(prop("Due Date")) > year(now()), toNumber(formatDate(prop("Due Date"), "DDD")) + 365 - toNumber(formatDate(now(), "DDD")), if(year(prop("Due Date")) < year(now()), toNumber(formatDate(prop("Due Date"), "DDD")) - 365 - toNumber(formatDate(now(), "DDD")), toNumber(formatDate(prop("Due Date"), "DDD")) - toNumber(formatDate(now(), "DDD") )))```
If you're still learning to use Notion, I'd highly recommend checking out Francesco D'Alessio's courses -