Add 1 hour to time
Timothy Miller
gandalf at doctorTimothyMiller.com
Mon Apr 17 14:52:13 EDT 2006
>I know there must be a simple way to do this but it's excaping me. I
>just need to add one hour to a time that I've set. Here's the code that
>doesn't work but it's the general idea:
>
>on mouseUp
> put "10:00 AM" into currentTime
> put "currentTime + 1:00" into FutureTime
> answer FutureTime
>end mouseUp
>
>Can someone show me how to set a time into a variable and add an hour to
>it. Thanks, Jeff
>
convert currentTime to seconds
put (60*60) + currentTime into futureTime -- add the number of
seconds in one hour
convert futureTime to short time
answer futureTime
You can also do it by converting the time to dateItems and
manipulating those (it's in the documentation) but it's often tidier
to do time arithmetic in seconds.
HTH
Tim
More information about the use-livecode
mailing list