Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am developing software to query two dates on the MySql server. With these two dates I subtract and display the value. The problem is that the display is 1.13: 04: 28.09933. The format is in dd.hh: mm: ss: mmmmmm. I want him to add the day to the hours. Example: 1 day = 24 hours, then 1.13: 04: 28.09933 = 37:04:28 (only hh: mm: ss)

What I have tried:

MessageBox.Show(tsystem.ToString(@"hh\:mm\:ss"))
Posted
Updated 26-Mar-19 11:02am

1 solution

Neither the standard[^] nor the custom TimeSpan format strings[^] provide an option to do that. You'll need to construct the string by hand instead:
VB.NET
MessageBox.Show(string.Format("{0:#,##0}:{1:mm}:{1:ss}", Math.Truncate(tsystem.TotalHours), tsystem));
 
Share this answer
 
Comments
Maciej Los 27-Mar-19 15:04pm    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900