# Calculate number of days

**URL:** <https://community.spicecrm.io/t/calculate-number-of-days/776>\
**Category:** KReporter\
**Created:** [August 15, 2025, 2:11pm UTC](https://community.spicecrm.io/t/calculate-number-of-days/776 "2025-08-15T14:11:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsp](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@rsp](https://community.spicecrm.io/u/rsp)\
**Post date:** [August 15, 2025, 2:11pm UTC](https://community.spicecrm.io/t/calculate-number-of-days/776/1 "2025-08-15T14:11:08Z")

</div>

Hello @maretval, 😃

We have date created(mm/dd/yyy hh:mm AM/PM) and Completed Date (mm/dd/yyyy) formats in the Cases module.

Now, we want to find the number of days between date created & completed date. How could we do it in the kreporter?

---

<div class="post-metadata">

**Author:** ![maretval](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@maretval](https://community.spicecrm.io/u/maretval)\
**Post date:** [August 18, 2025, 6:11am UTC](https://community.spicecrm.io/t/calculate-number-of-days/776/2 "2025-08-18T06:11:20Z")

</div>

With a custom SQL Function. In my example I count the number of days between date\_entered and date\_closed in the opportunities module.

I dragged date\_entered whoch is represented by {t}.{f} in the SQL function.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/0a9f5583d74510dd460a5d8da3a5bced8990550c.png)

Then you need to override the field type in the presentation for the number of days. Since the field you drag is of type date, you have to change it to integer

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/480a2f7695a9aee3ec0a6c0319c5c1256193d3ec.png)
