How to convert the time 11:21:21 into total minutes?
A:
How about something like
totalMins = (60 * hrs) + mins + (secs / 60)
astander
2009-12-21 06:40:19
+2
A:
Get the time as a TimeSpan value using the TimeOfDay method, then use the TotalMinutes method to get the time in minutes:
DateTime t = new DateTime(0, 0, 0, 11, 21, 21);
double minutes = t.TimeOfDay.TotalMinutes;
The minutes variable now contains 681.35
. If you want the value as whole minutes use Math.Round or Math.Floor, depending on how you want it rounded:
int minutes = (int)Math.Floor(t.TimeOfDay.TotalMinutes);
Guffa
2009-12-21 06:45:12