I have a time expressed in minutes and I want to format it as day-hr-min
with two digits for each part.
For example:
2305 minutes => 01-14-25
2602 minutes => 01-19-22
I have a time expressed in minutes and I want to format it as day-hr-min
with two digits for each part.
For example:
2305 minutes => 01-14-25
2602 minutes => 01-19-22
Your question is a near-duplicate of What is the best way to convert seconds into (Hour:Minutes:Seconds:Milliseconds) time?
In your case you would do:
string formatted = TimeSpan.FromMinutes(2602).ToString(@"dd\-hh\-mm");
Result:
01-19-22