[REBOL] Re: add 1 month to date
From: joel:neely:fedex at: 3-Apr-2003 6:27
Hi, Carl and Mark,
Carl Read wrote:
> > how do you add 1 month to "a" so that a becomes 15/4/2003? Add 31
> > days can't do as some month has 30 and 31 days. Thanks.
>
> >> a: 15/3/2003
> == 15-Mar-2003
> >> a/month
> == 3
> >> a/month: a/month + 1
> == 4
> >> a
> == 15-Apr-2003
>
That gives a possibly-surprising result if a/day is greater than the
number of days in a/month + 1 (for the current a/year, of course ;-)
>> a: 31/1/2003
== 31-Jan-2003
>> a/month: a/month + 1
== 2
>> a
== 3-Mar-2003
-jn-
--
Polonius: ... What do you read, my lord?
Hamlet: Words, words, words.
_Hamlet_, Act II, Scene 2