Page 1 of 1

Tic tac, tic tac........ but less two tic? (='.'=)

Posted: Wed Jun 28, 2017 3:55 pm
by Mariasole
Hello everyone!

I have a stupid question :oops: , but it's days I try and I can not find a solution :shock: .
In the end I decided to ask for help from experts! Gentlemen, of course! :D

I'm trying to do simple timetable operations, not dependent on fully dates. Only timetables. Simple stuff (in natural language!).

Example:
What time is the 6:30 less than a minute? -----> 6:29
And the 23 and 58 less a minute? -------> 23:57
And the 23 and 59 plus two minutes? ------> 00:01
And the 18:35 plus 37 minutes? --------> ??? I need LC function!!! :wink:

I tried to use DateFormat function, but I do not understand the method without using a specific day.
I know someone is now laughing !!!! Let me also laugh at me! :lol: :lol: :lol:

:shock:

Thanks to all those who want to give me a hand!

Mariasole
(='.'=)

Re: Tic tac, tic tac........ but less two tic? (='.'=)

Posted: Wed Jun 28, 2017 4:04 pm
by Klaus
Hola Maria,

OK, here is mine :D
hand.jpg
hand.jpg (30.81 KiB) Viewed 7069 times
Try this:

Code: Select all

on mouseUp
   ## I'm german so to avoid english time with AM/PM I do:
   set the usesystemdate to TRUE
   put "18:35" into tTime
   convert tTime to seconds
   add 37*60 to tTime
   convert tTime to short time
   put tTime ## -> 19:12
end mouseUp
Best

Klaus

Re: Tic tac, tic tac........ but less two tic? (='.'=)

Posted: Fri Jun 30, 2017 12:44 pm
by MaxV
This is the function you need:

########CODE to copy and paste#######
on mouseUp
put libdate_addminutes("18:35",37)
end mouseUp

function libdate_addminutes pTime, pMinutes
#pTime format = "13:15" or 13:15:59"
#pminutes is a integer positive or negative
set itemdel to ":"
put item 1 of ptime into tOre
put item 2 of ptime into tMinuti
put item 3 of ptime into tSecondi
put tMinuti + pMinutes into tMinuti
if pMinutes > 0 then
put tOre + floor(tMinuti / 60) into tOre
else
put tOre - floor(tMinuti / 60) into tOre
end if
puttMinuti mod 60 into tMinuti
put tOre mod 24 into tOre
if the number of chars of tMinuti is 1 then put 0 before tMinuti
if the number of chars of tOre is 1 then put 0 before tOre
if tSecondi is empty then
return (tOre & ":" & tMinuti )
else
return (tOre & ":" & tMinuti & ":" & tSecondi )
end if
end libdate_addminutes
#####END OF CODE generated by http://tinyurl.com/j8xf3xq with livecode 9.0.0-dp-6#####

Re: Tic tac, tic tac........ but less two tic? (='.'=)

Posted: Fri Jun 30, 2017 2:03 pm
by Mariasole
Hey Klaus!
Then you are a friend of my uncle! :wink:

Image

Thanks for your help! Now I'll start experimenting! :D

Thanks also to you Max! :D I'll also try your "expanded" solution!

Thanks again to everyone!

Mariasole
(='.'=)

Re: Tic tac, tic tac........ but less two tic? (='.'=)

Posted: Fri Jun 30, 2017 2:09 pm
by Klaus
Tony is your uncle? Wayyyy cool! :D

Re: Tic tac, tic tac........ but less two tic? (='.'=)

Posted: Tue Jul 04, 2017 2:00 pm
by Mariasole
In a world where we are all sisters and brothers, he is a third degree uncle :wink:

(='.'=)

Re: Tic tac, tic tac........ but less two tic? (='.'=)

Posted: Tue Jul 04, 2017 3:40 pm
by Klaus
Mariasole wrote:In a world where we are all sisters and brothers, he is a third degree uncle :wink:

(='.'=)
OK, I get it, sister! :D

Re: Tic tac, tic tac........ but less two tic? (='.'=)

Posted: Thu Jul 06, 2017 2:17 am
by [-hh]
@Klaus.

Sister? Or rather niece?

Re: Tic tac, tic tac........ but less two tic? (='.'=)

Posted: Thu Jul 06, 2017 2:56 pm
by Klaus
"Sister", Herman, since I was referring to Marias last posting:
... In a world where we are all sisters and brothers ...
:D

Re: Tic tac, tic tac........ but less two tic? (='.'=)

Posted: Thu Jul 06, 2017 3:15 pm
by [-hh]
Oh I see, you won't be an uncle ...

Re: Tic tac, tic tac........ but less two tic? (='.'=)

Posted: Thu Jul 06, 2017 3:18 pm
by Klaus
[-hh] wrote:Oh I see, you won't be an uncle ...
Exactly, that's Bob already! :D