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

[REBOL] Re: How to scale Date-Time properly in REBOL?

From: rebol:optushome:au at: 14-Jan-2002 22:35

;
> ; Dates > ; > > add-months: function [ > "Add months to a date." > date [date!] > months [integer!] > ] [result-date delta-years delta-months] [ > delta-years: to-integer divide months 12 > delta-months: remainder months 12 > if lesser? delta-months 0 [ > delta-years: subtract delta-years 1 > delta-months: add delta-months 12 > ] > result-date: date > result-date/year: add result-date/year delta-years > result-date/month: add result-date/month delta-months > return result-date > ] >
Maybe I'm missing something there, Brett, but that looks like a bit of overkill? add-months: func [ "Add months to a date." date [date!] months [integer!] ][ date/month: date/month + months date ] Cheers, Allen K