SecondsToString
Converts the number of seconds to a string displaying hours and minutes
Source
/// <summary>
/// Converts the seconds to an hour \ min display string.
/// </summary>
/// <param name="totalSeconds">The \total seconds.</param>
/// <returns>A string in the format x hours y mins.</returns>
public static string SecondsToString(this int totalSeconds)
{
var s = TimeSpan.FromSeconds(totalSeconds);
return string.Format("{0} hours {1} mins", (int)s.TotalHours, s.Minutes);
}
Example
int seconds = 7863;
string display = seconds.SecondsToString(); // 2 hours 11 mins