Time Calculator Online - online tool that allows adding time
given in hh:mm:ss.ms (hour,minute,second,milisecond) as well as decimal time format. It could also work as time format converter.
Begin:
Add to the form the textboxes with index=0
Textboxes for : Operation(0) , Hours(0) , Min(0) , ...
The best way is to go in 3 steps:
1- Update display on clicking the Operation command (+, -, ..):
Add textboxes with "Load" from the original ones (Operation(0) , Hours(0),...) with index= ubound + 1
set the Top of the new textboxes in function of the index like:
2- calculate in function of the Operation command. !!! calculate with the lowest unit (sec, milsec, ...)=
If the lowest unit= sec. => set hours to sec, set min to sec,... make the operations for index (of one component like: TextboxHours) from Lbound to Ubound.
Code:
for i= textHours.lbound to textHours.ubound
Select case Operation(i).caption
case "+": Result= Result + (textHours(i)*3600) + (textMin(i)*60) +...
case "-": Result=Result - ...
end select
next
3- Adapt the display in function of the result=
hours= int(result/3600)
minutes = int((result - hours )/60)
...
Comment