Adding time in hh:mm

08:50 + 09:13 + 08:30 + 09:27 + 08:52 (Add across and result in hh:mm. The result should be 44:52 (hh:mm) - how do I arrive to this total? Any codes will be much appreciated.

How do I do the follwing ?

1. I would like users to enter 0850 rather than having to type : (colon) in the middle.

2. As soon as the user enters four digits the cursor should automatically move to next column without having to press enter or tab.

I have tried and tried but failed miserably. Any help on codes would be greatly appreciated.

D R :'(

One way is to separate the hours from the minutes and add them up = 42 hours, 172 minutes. Divide the minutes by 60 using INT divinsion - 172\60 = 2 or INT(172/60) = 2, so you have to add 2 hours to the 42 = 44 hours. To get the remaining minutes, use 172 MOD 60 = 52. Thus 44 hours 52 minutes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.