Convert minutes to full time C#
Use TimeSpan.FromMinutes
:
var result = TimeSpan.FromMinutes(1815);
This will give you an object that you can use in different ways.
For example:
var hours = (int)result.TotalHours;
var minutes = result.Minutes;
you can use this function
//minutes to be converted (70minutes = 1:10 hours)
int totalminutes = 70;
//total hours
int hours = 70 / 60;
//total minutes
int minutes = 70 % 60;
//output is 1:10
var time = string.Format("{0} : {1}", hours, minutes);