I have two datetimes which I do want to compare.
Currently, this is the code im using:
if (entry.Year == time.Year &&
entry.Month == time.Month &&
entry.Day == time.Day &&
entry.Hour == time.Hour &&
entry.Minute == time.Minute)
{
// condition met!
}
To me, such a big chunk of code is quite hard to grasp at first glance when scrolling over. Is there a more clean way to do that or would the best option be to create a small function for this?
Important: I want to check if the datetimes are both in the same minute and not if there are max 60 seconds apart.
So for example:
- 2022/10/10 10:10:01 matches 2022/10/10 10:10:59
- 2022/10/10 10:10:59 does not match 2022/10/10 10:11:01