Saturday, August 6, 2011

Convert time format 'hh:mm:ss' into Minutes


I have a time in the format "hh:mm:ss" and I want to convert this into Mintues.
For example
00:00:38 convert to 1 Mintues

00:01:36 Convert to 2 Mintues

00:01:04 Convert to 2 Mintues
01:01.05 Convert to 62 Mintues

This will round it up to the nearest minute:
DateTime RoundUp = DateTime.Parse("00:00:38");
RoundUp.AddSeconds(60 - RoundUp.Second);

1 comment: