VB Code:
  1. Private Sub Text1_Change()
  2.     Dim dtmTest As Date
  3.     dtmTest = Abs(Val(Text1.Text)) / 24
  4.     Me.Caption = Format$(DateDiff("h", CDate(0), dtmTest), "0:") & Format$(dtmTest, "nn:ss")
  5. End Sub

Please, don't use a label to store the data as a string. The use of incorrect datatype is why you have to add the .000000000000001 cheat in your current code. My code above works just fine without any cheats, because it uses the correct datatype and no coercions ("automatic conversions") happens in the code. Besides giving you headache on "not working as expected", coercions slow down your code, although it doesn't matter in this case just as much.

Also, don't rely on default object properties: if you want to change a caption of a label, use Label.Caption. This for two reasons: code with .Caption executes faster and also use of .Caption makes the code more readable.


Dates (and Doubles) are a floating point datatype. The way they work internally ("float" the decimal point within an integer number) is the problem you encountered and how a floating point number is converted into a date.