# How to Compute Days Between Two Dates in Linx (with Leap Year Support)

**URL:** https://community.linx.software/community/t/how-to-compute-days-between-two-dates-in-linx-with-leap-year-support/762
**Category:** How To
**Created:** [December 12, 2025, 7:06am UTC](https://community.linx.software/community/t/how-to-compute-days-between-two-dates-in-linx-with-leap-year-support/762 "2025-12-12T07:06:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Shantoie](https://community.linx.software/community/user_avatar/community.linx.software/shantoie/32/1376_2.png) [@Shantoie](https://community.linx.software/community/u/Shantoie)
#### Post date: [December 12, 2025, 7:06am UTC](https://community.linx.software/community/t/how-to-compute-days-between-two-dates-in-linx-with-leap-year-support/762/1 "2025-12-12T07:06:28Z")

</div>

## Calculating the Difference Between Two Dates in Linx (Handling Leap Years)

When working with date calculations in Linx, especially for determining the **difference between two dates** , it’s important to ensure your approach is both accurate and robust to all calendar scenarios—such as leap years.

_Note that this approach will give you the difference between to dates in days_

**While some solutions manually add days based on year or month differences, this can easily introduce errors, especially when dealing with leap years or months of varying lengths.**

**The recommended method in Linx is to use the built-in expression editor to subtract one `DateTime` value from another:**

```csharp
(DateTimeEnd - DateTimeStart).Days

```

This expression will return the **exact number of days** between the two dates, and it will correctly include or exclude February 29th in leap years and handle all other irregularities in the calendar for you.

> **Note:**  
> This approach requires that both values (`DateTimeStart` and `DateTimeEnd`) are already of the `DateTime` type. If your source data is already stored as `DateTime` values (passed in as parameters or already defined as such in your process), you’re good to go—no extra parsing or conversion needed!

* * *

### Example

Here you can see the calculation done with no leap year dates:

 ![image](https://community.linx.software/community/uploads/default/original/2X/a/ae0e88cf1f520145da1fbe3d0185c4d1547d10c5.png)

And here is the calculation done with dates that are part of a leap year:

 ![image](https://community.linx.software/community/uploads/default/original/2X/6/61ca34f1087b33473d1ab5b2381991445cb63cec.png)

* * *

### Summary

- Use `(DateTimeEnd - DateTimeStart).Days` for a safe, leap-year aware calculation.
- Ensure both inputs are of type `DateTime`.

This will provide you with a simple, accurate, and future-proof date difference calculation in Linx.
