A challenge: adding months to a date?

Klaus Major klaus at major-k.de
Sun May 13 11:41:16 EDT 2007


Hi David,

> I thought this was easy! Well I discovered a bug in some old code  
> and now I
> am pulling my hair out trying to fix / code this... an interesting  
> puzzle
> for those of you so inclined on a Sunday :)
>
> The Task
> The function needs to add a variable number of months to a given date:
>
> function date_AddMonth monthNum, startDate
>    ....
> end date_AddMonth
>
> Seems easy no?
> ...

Hmmm, I always use "dateitems", let the engine do the conversion and  
never had problem.
...
convert tDate to dateitems
add num_of_extra_months to item 2 of it
convert tDate to date
...

Or am I missing something?


Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de




More information about the use-livecode mailing list