by pillick >> Thu, 5 Dec 2002 2:24:42 GMT
Hey,
Im having alot of problems with something I thought would be very easy.
One of my funtions takes a date and returns the date exactly one month before it. The algorithm works like this:
if date.month > 1 then
prevDate.setDateYearAbsolute(date.day, date.month - 1, date.year) ; else
prevDate.setDateYearAbsolute(date.day, 12, date.year - 1) ;
endif ;
I cant see any reason why such a simple function would give the wrong answer, but somehow it does.
Here is an example of it going wrong:
----> 30 May 2001
----> 30 April 2001
----> 30 March 2001
----> *invalid*
Anyone have any idea whats going on??