Help with code

Renegade

Member
Licensed User
Longtime User
Hi
I need the decimal to 1 decimal place for the difference in two times

I have this code
B4X:
Label13.text = DateTime.Time(DateTime.Now)
Label13.Enabled = False
Dim x, y, z As Long
x = DateTime.TimeParse(Label13.text)
y = DateTime.TimeParse(Label12.text)
z = x - y
Label15.Text = z

Can anyone help
Thanks
 

Renegade

Member
Licensed User
Longtime User
for a 1 sec difference in time
z = 1000
What I am looking for is a formula that converts the variance into a decimal hr
eg
150 min = 2.5hrs
80 min = 1.3hrs

and so on
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
I need the decimal to 1 decimal place for the difference in two times
Can you elaborate on what you mean by '1 decimal place' in relation to time? As far as I know there are no decimal places in time unless you mean 6.5 hours or something like that.
 
Upvote 0

Renegade

Member
Licensed User
Longtime User
It OK Solved it
B4X:
Label13.text = DateTime.Time(DateTime.Now)
   Label13.Enabled = False
   Dim x, y, z As Long
   x = DateTime.TimeParse(Label13.text)
   y = DateTime.TimeParse(Label12.text)
   z = x - y
   Label15.Text = Round2(z/60000/60,1)

/60000 converts it to min /60 converts to decimal hrs
round2( ,1) rounds to 1 decimal place

Thanks all anyway
 
Upvote 0
Top