convert a current date into a future date

Kay C Lan lan.kc.macmail at gmail.com
Thu Jun 18 23:23:51 EDT 2009


On Fri, Jun 19, 2009 at 10:38 AM, Nicolas Cueto <niconiko at gmail.com> wrote:

>
> Of course, it'd need to take into account the
> number of days in a month, a change in year,
> and leap years. Centenial or millenial changes
> can be ignored.
>

I think you'll find it's easier than you think. Using dateItems solves all
these problems for you, try this in your message box:

put the date into startDate
convert startDate to dateitems
add 1 to item 1 of startDate --year item
add 24 to item 2 of startDate --month item
add 1095 to item 3 of startDate --day item
convert startDate to long date
put startDate

Basically it adds 1 year to the current date using years, then 2 years using
months, then three years using days.
You can also use hours ( item 4), minutes (item 5) or seconds (item 6). It
doesn't matter, so if you want to know the date and time 3000 hours from
now, you can just by adding 3000 to item 4 and Rev will figure out how many
days in each of the intervening months and do all the hard work for you :-)

If you add 3000 to item 3 (days) Rev will figure out all the leap year stuff
for you.

Not sure how accurate it is with Centenial and Millenial stuff but if you
add 3000 to item 1 it does give an answer.

It also automatically figures out the day of the week for you :-)

HTH



More information about the use-livecode mailing list