Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time Display on form

Status
Not open for further replies.

Revolution1200

Programmer
Sep 29, 2005
143
GB
Help,

I am summing a number of times from an access database to show time utilised over a month.

How do I display the time as HH:MM:SS for say 45 hours 15 minutes and 23 seconds

I can convert the double to a datetime using FromOADate.

Thanks

Stuart
 
Hi All,

Never mind, came up with

Dim test As DateTime

Dim daysToHours As Long

test = DateTime.FromOADate(5.79226851851852)

daysToHours = test.Day * 24

daysToHours = daysToHours + test.Hour

MsgBox(daysToHours.ToString.PadLeft(2, "0"c) & ":" & test.Minute.ToString.PadLeft(2, "0"c) & ":" & test.Second.ToString.PadLeft(2, "0"c))

Moving from VB6 to .net and this tripped me up big time!

Cheers

Stuart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top