mojoansool
asked on
What would be the equivalent in VB.NET of the time format [h]:mm in EXCEL ?
Hi Experts
In EXCEL, we have a very practical time format [h]:mm that preserve the hours in hours. For example, 25 hours in [h]:mm would be expressed as 25:00 instead of 01:00 for all other formats with hh, like hh:mm or HH:mm.
What would be the equivalent in VB.NET of this very neat format? Is there a simple way to format 25 hours in VB.NET like 25:00 ? Do I have to build a formatting method of my own?
Thank you for the information.
In EXCEL, we have a very practical time format [h]:mm that preserve the hours in hours. For example, 25 hours in [h]:mm would be expressed as 25:00 instead of 01:00 for all other formats with hh, like hh:mm or HH:mm.
What would be the equivalent in VB.NET of this very neat format? Is there a simple way to format 25 hours in VB.NET like 25:00 ? Do I have to build a formatting method of my own?
Thank you for the information.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
For this format I'm looking for, I guess I will have to settle for a custom build. In the mean time, jpaulino made me realize the existence of the TimeSpan structure. Thanks.
If you use a TimeSpan you can simply get the Hours and the minutes.
Dim ts As New TimeSpan(25, 22, 0)
Dim time As String = (ts.Hours.ToString() & ":") + ts.Minutes.ToString()