> I get a timestamp in seoncds from a database e.g 1220298324 which is equal to 
> 21:45:24.  I then take the actual time (also in seconds) and want to compare 
> the actual time with this timestamp to find out the difference.I just 
> substract the timestamp from the actual time in seconds to get the 
> difference. Lets say the difference is 1754 seconds (29minutes 14seconds).
> Now i convert the seconds into the short system time and get 01:29:14 and not 
> 0:29:14. The result shows 1 hour more than it should do.
>
> To avoid posting my original code (i am using german expressions in my code) 
> i created the example, which shows the same behaviour.
>
>
> put 1754 into tTimestamp
> convert tTimestamp to short system time  -- converts from seconds to short 
> system time
> put tTimestamp                           -- shows 01:29:14 in messagebox, but 
> should be 0:29:14
>
> How can i solve this? Any ideas are welcome.

The "convert" command allows for time zones so the same value in
seconds will give different times & dates depending on the time zone
of the converting computer.
In this case, where you are trying to get the difference between 2
times, I think the best option is to convert the difference in seconds
into hours & minutes manually.

Try this function:

function secondsToTime pSecs
    put pSecs div 3600 into tHours
    put pSecs mod 3600 into tMinsSecs

    put tMinsSecs div 60 into tMins
    put tMinsSecs mod 60 into tSecs

    if tMins < 10 then put "0" before tMins
    if tSecs < 10 then put "0" before tSecs

    return tHours & ":" & tMins & ":" & tSecs
end secondsToTime

Cheers,
Sarah
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to