Re-4: some trouble with convert
runrev260805 at m-r-d.de
runrev260805 at m-r-d.de
Mon Sep 1 17:58:52 EDT 2008
Thanks Sarah,
i will give that a try. Looks more professional than my workaround i used to go further on:
set the itemdelimtiter to ":"
convert tTimestamp from seconds to the short system time
add -1 to item 1 of tTimestamp
set the itemdelimiter to TAB
@BNig
Thanks, thought about this already, but the program has to be run on a client computer, where we cannot adjust region settings due to missing permissions.
Regards,
Matthias
-------- Original Message --------
Subject: Re: Re-2: some trouble with convert (01-Sep-2008 23:25)
From: Sarah Reichelt <sarah.reichelt at gmail.com>
To: runrev260805 at m-r-d.de
> > 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
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
>
>
> To: use-revolution at lists.runrev.com
More information about the use-livecode
mailing list