- Home /
TimeSpan does the difference automatically count the minutes
Hey Everyone, I have a line in my code that will find the difference between my last end time and my current start time. It will post the Debug line like this
"the difference is 12:15:27"
which is great. However, what I'm trying to figure out is when a new hour starts, if I create an IF STATEMENT, will the difference factor in the prior minutes as well. So I'm trying to see if I have a line like this
If (diff.TotalMinutes > 60)
{
do something here
}
where "diff" is a declared variable that I got by subtracting the two times.
I'm trying to figure out if the total difference is something like 01:12:15 (where that is clearly 72 minutes) would i need to convert that hour to a minute or does totalMinutes implicitely do that for me.
Answer by Jeezker · Apr 22, 2019 at 11:49 PM
use Debug.Log(diff.TotalMinutes); to see what it is in the console
oh that's cool, so that code will show me whats specifically happening!?
DUDE (OR DUDETTE)! Genius, it converts it implicitly. That's great. Thank you! Now that I see it, i'm sure it's a common and obvious method BUT I am so new to TimeSpan THAN$$anonymous$$S!