Hello,
I'm new in Livecode use.
I done tutorials and some search on the lessons part of the site.
I would like to manipulate date and time.. just add some days, some hours or minutes.
I found the wait to get the time & date, to convert it into item.... so I can manipulate Items but therefore I don't have any automatic controls on format (35 minutes + 30 = 65 minutes !!) and even I cannot convert back into a "normal" time variable.
Can somebody help me ?
Thanks
Hapache
Manipulation of time and date
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Manipulation of time and date
Hi Hapache,
please check "convert" and "dateitems" in the docs (LiveCode ditionary), which lets you do what you want.
You only need to "convert" the modified "dateitems" back to "date" or whatever, LiveCode will manage the correct "new" date"!
Example:
...
## We want to know the date in 27 days from today
put the date into tDate
convert tDate to dateitems
add 27 to item 3 of tDate
convert tDate to date
answer "In 27 days we will have:" && tDate
...
You get the picture
Best
Klaus
P.S.
Welcome to the forum!
please check "convert" and "dateitems" in the docs (LiveCode ditionary), which lets you do what you want.
You only need to "convert" the modified "dateitems" back to "date" or whatever, LiveCode will manage the correct "new" date"!
Example:
...
## We want to know the date in 27 days from today
put the date into tDate
convert tDate to dateitems
add 27 to item 3 of tDate
convert tDate to date
answer "In 27 days we will have:" && tDate
...
You get the picture

Best
Klaus
P.S.
Welcome to the forum!
Re: Manipulation of time and date
Thanks,
I needed the "convert XX to date or to time" function.... it's what I called convert back.
It works.
Thanks for this quick answer
Hapache
I needed the "convert XX to date or to time" function.... it's what I called convert back.
It works.
Thanks for this quick answer
Hapache
Re: Manipulation of time and date
Also note that the convert command does all the math for you. It is very nice that way. So you can add or subtract anything to any of those dateItems, and the result will still be valid. In other words, if you add 1000 days to item 3, when you convert back, the year, month and day will be correct.
Craig Newman
Craig Newman