0

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
Brian Rogers
  • 118,414
  • 30
  • 277
  • 278

1 Answers1

0

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
Community
  • 1
  • 1
Brian Rogers
  • 118,414
  • 30
  • 277
  • 278