# Calculating Accurate Time Difference Across Months for Coin Farming

**URL:** <https://forums.unrealengine.com/t/calculating-accurate-time-difference-across-months-for-coin-farming/1267642>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [August 21, 2023, 11:32am UTC](https://forums.unrealengine.com/t/calculating-accurate-time-difference-across-months-for-coin-farming/1267642 "2023-08-21T11:32:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fon\_Rachello](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fon\_Rachello](https://forums.unrealengine.com/u/Fon_Rachello)\
**Post date:** [August 21, 2023, 11:32am UTC](https://forums.unrealengine.com/t/calculating-accurate-time-difference-across-months-for-coin-farming/1267642/1 "2023-08-21T11:32:13Z")

</div>

Hello everyone who is reading this post. I have problem with game I develop. Player has to manage characters to farm coins. Coins could be farmed even when game is closed. To my mind the easiest way to do that just count the time difference between now(player opens the game) and the last time when player closed the game. Everything is fine when player starts the game after some time, but when the date passes to the next month time difference counts incorectly. So how could I take into consideration that month changed?

 ![na vopros](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/3/7/2376bd233daf27c9cb72d6ac93a0ed21fdb71aff.png)

---

<div class="post-metadata">

**Author:** ![IrSoil](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IrSoil](https://forums.unrealengine.com/u/IrSoil)\
**Post date:** [August 21, 2023, 11:55am UTC](https://forums.unrealengine.com/t/calculating-accurate-time-difference-across-months-for-coin-farming/1267642/2 "2023-08-21T11:55:50Z")

</div>

I guess you looking for `DateTime - DateTime`:

 ![изображение](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/c/6/9c6bedcb014b2ab49f5001e60ed47ac55229d517.png)

Note that according to [Unreal Engine Issues and Bug Tracker (UE-135466)](https://issues.unrealengine.com/issue/UE-135466) it was broken in engine versions from 5.0 to 5.2

---

<div class="post-metadata">

**Author:** ![Fon\_Rachello](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fon\_Rachello](https://forums.unrealengine.com/u/Fon_Rachello)\
**Post date:** [August 22, 2023, 11:49am UTC](https://forums.unrealengine.com/t/calculating-accurate-time-difference-across-months-for-coin-farming/1267642/3 "2023-08-22T11:49:20Z")

</div>

Thank you for your answer. I downloaded older version (4.27) of UE and did it in there because it works in older versions. After that I copied this substraction into my current project and it seems that it works.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [September 21, 2023, 11:49am UTC](https://forums.unrealengine.com/t/calculating-accurate-time-difference-across-months-for-coin-farming/1267642/4 "2023-09-21T11:49:43Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
