I want to calculate how much time elapsed between a datetime and now in minutes.
This is what I have:
TimeSpan SinceStatusChange = new TimeSpan();
SinceStatusChange = (double)(DateTime.Now.Date - StatusDateTime).TotalMinutes;
Basically, I’m looking to write this conditional statement:
if (SinceStatusChange is greater than 180 minutes)
How do I write the line “SinceStatusChange = ” so I can later test if the value is greater than 180?
Thanks.
Well you are trying to assign a
doubleto aTimeSpanwhich, for obvious reasons, will not work. You already have what you want really, just use: