[REBOL] Re: add/subtract with date!
From: allen:rebolforces at: 14-Nov-2000 18:47
Hi Tom,
REBOL makes it exceptionally easy to do.
.
date: 14-Nov-2000
date/day: date/day + 10
print date
24-Nov-2000
date/month: date/month + 3
print date
24-Feb-2001
date: 14-Nov-2000
date/year: date/year - 1
print date
14-Nov-1999
Only thing to watch is a bug in month subtraction. It goes flaky if you
subtract prior to January . (Hopefully will be fixed soon Feedback #4014)
date: 14-Nov-2000
date/month: date/month - 12
print date
14-Mar-23845
But subtraction using days does not have this problem
date: 14-Nov-2000
date/day: date/day - 366
print date
14-Nov-1999
----- >
> Final question: Is there any easy way of adding/subtracting months or
years
> without having to check for boundaries myself???
Have a look at the calendar style script on my Rebsite, you will find a
comment in that script where I handle the bug.
Cheers,
Allen K