Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

add 1 month to date

 [1/6] from: mark:jobstreet at: 3-Apr-2003 17:58


I am sure it is a simple question but some how I could not figure it out. How do you add 1 full month to the date variable. Example: a: 15/3/2003 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. Mark Chang - [mark--jobstreet--com] Founder of JobStreet.com, www.jobstreet.com 250 Tanjong Pagar Road #11-01 St Andrew's Centre Singapore 088541 Fax: 65-6538 0090 Tel: 65-6538 0060 #1 Ground Floor Office, Equatorial Penang, 1 Jalan bukit Jambul, 11900 Penang Malaysia. Fax: 604 643 6461 Tel: 604 644 5912

 [2/6] from: antonr:iinet:au at: 3-Apr-2003 20:21


>> date: now
== 3-Apr-2003/20:20:44+10:00
>> date/2: date/2 + 1
== 5
>> date
== 3-May-2003/20:20:44+10:00 Anton.

 [3/6] from: lmecir::mbox::vol::cz at: 3-Apr-2003 13:05


Hi Mark,
> I am sure it is a simple question but some how I could not figure it out. How > do you add 1 full month to the date variable. Example: > > a: 15/3/2003 > > 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.
how about: a/month: a/month + 1 HTH -Ladislav

 [4/6] from: carl::cybercraft::co::nz at: 24-Dec-2003 22:14


On 03-Apr-03, Mark Chang wrote:
> I am sure it is a simple question but some how I could not figure it > out. How do you add 1 full month to the date variable. Example: > a: 15/3/2003 > 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 help? :) -- Carl Read ------------------------ United Nations Scorecard 20th Century - world wars: 1st half 2, 2nd half 0. 21st Century - world wars: Results not in.

 [5/6] from: ingo:h-o-h at: 3-Apr-2003 13:18


Hi Mark, Anton wrote:
>>>date: now > == 3-Apr-2003/20:20:44+10:00
<<quoted lines omitted: 3>>
> == 3-May-2003/20:20:44+10:00 > Anton.
Or, more intuitively
>> date/month: date/month + 1
== 5
>> date
== 3-May-2003/20:20:44+10:00

 [6/6] 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.
<<quoted lines omitted: 6>>
> >> 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

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted