# Count days between 2 dates (calendar)

**URL:** <https://forums.unrealengine.com/t/count-days-between-2-dates-calendar/716431>\
**Category:** Programming & Scripting\
**Tags:** windows-10, unreal-engine, Blueprint, CPP\
**Created:** [November 27, 2022, 6:57pm UTC](https://forums.unrealengine.com/t/count-days-between-2-dates-calendar/716431 "2022-11-27T18:57:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peleias](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/peleias/32/494475_2.png) [@Peleias](https://forums.unrealengine.com/u/Peleias)\
**Post date:** [November 27, 2022, 6:57pm UTC](https://forums.unrealengine.com/t/count-days-between-2-dates-calendar/716431/1 "2022-11-27T18:57:08Z")

</div>

Hi Folks.  
Does anyone have the formula for Count days between 2 dates (calendar)?  
If I understand correctly, it is not possible to do it with blueprint.

This is a function that already exists on the internet, searching for C++ code in other systems… But I’m a beginner in C++ for Unreal, but I couldn’t convert and even trying I got stuck when converting data to float.

I already have a calendar system, so the function would have 2 date entries (example 01/01/2000 and 01/03/2001 as the excel datadif).

I really appreciate the help.  
Thanks!

---

<div class="post-metadata">

**Author:** ![NikitaAksenov](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NikitaAksenov](https://forums.unrealengine.com/u/NikitaAksenov)\
**Post date:** [November 30, 2022, 8:49am UTC](https://forums.unrealengine.com/t/count-days-between-2-dates-calendar/716431/2 "2022-11-30T08:49:15Z")

</div>

As far as I know, you can use DateTime and Timespan for that task.

Unfortunately, right now you can’t substract DateTime’s from each other in Blueprints, node for that is broken ([Unreal Engine Issues and Bug Tracker (UE-135466)](https://issues.unrealengine.com/issue/UE-135466)).

But you can easily do that in C++:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/2/34292a72593ea3ed15945ba470181a09de8cc001.png)

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/f/2/0f2fd268de3c32ef2e5f49261e6ad9499b00cb86.png)

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/8/0/980c45279fbb99372559a5ceefef3299e8b795cb.png)

---

<div class="post-metadata">

**Author:** ![Peleias](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/peleias/32/494475_2.png) [@Peleias](https://forums.unrealengine.com/u/Peleias)\
**Post date:** [December 1, 2022, 2:12am UTC](https://forums.unrealengine.com/t/count-days-between-2-dates-calendar/716431/3 "2022-12-01T02:12:35Z")

</div>

owwww, thank you so much!
