Time calcuation is wrong !

GuenterL

Member
Licensed User
Longtime User
Hi all,
to calculate the total time for a sport event, i have to add several section times, but the result seems to be wrong. The values are stored in a table:

Example:
At 12:00 o'clock, I want to add 1:45 minute. The calculation is done with the following code :

Table1.Cell("col3",0) = Time(TimeParse(StartTime) + TimeParse(Table1.Cell("col1",0))
filled in with values this means:
total time = Time(TimeParse(12:00:00) + TimeParse(01:45:00)

and the result = 12:44:00

How could this be ?????? any idea ????
Any help would be great.:
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
TimeParse returns a value which is equals to: Today + the specified time.
If you check the date that returns from your calculation you will see that it is somewhere around year 4020.
You can use TimeAdd instead.
Or you can try something like:
B4X:
timeInDay = TimeParse(01:45:00)  mod cTicksPerDay
total time = Time(TimeParse(12:00:00) + timeInDay)
 

GuenterL

Member
Licensed User
Longtime User
Thanks Erel,
that will make sense. I will change and try it again.
Thnaks a lot
Guenterl
 
Top