View Single Post
Old 10-27-2004, 03:10 PM   #4 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,173
Belisarius is on a distinguished road
Your February check doesn't seem right. You check to see if the day is 29, but don't check to see if it is, in fact, a leap year. Plus, you then go on to increment the day, but I can't think of an instance (apart from old Roman calendars) when February had 30 days.

Further, your leap-year check seems off, as you're checking to see if the year is a multiple of 4 AND 400. Needless to say that 2004, while being a leapyear, isn't a multiple of 400.

For the record, the way that leap-years work is that it's a leap-year every 4 years, except every 100 years, except every 400 years. That's why 1900 and 2100 won't be leap-years, but 2000 was.

Finally, your December check is off, as you set the next year to the current year. Hence, 12/31/04 will turn into 1/1/04.

Those are the mistakes I see off the top of my head. But, you didn't mention what was actually going wrong, so I'm not sure if I answered your question or not.
__________________
GitS
Belisarius is offline   Reply With Quote