commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <>
Subject [NET] 1.5 Leap year processing
Date Wed, 12 Mar 2008 20:36:31 GMT
I think I've found a solution to the leap year processing.

At present the code tries the short date and then adds the current
year if the parse fails.
This does not work on Java 1.4 or earlier because Feb 29 1970 does not
cause a parse failure - the date is converted to Mar 1 1970.

One solution seems to be to add the current year to the short date
initially, so Feb 29 will either parse OK or cause a failure if it's
not a leap year; the date won't be changed to Mar 1.

However, I've just realised that it won't work if the current date is
in Jan or Feb the following year, i.e. 10+ months later.

Are there any OSes which display short dates more than 10 months after
the file date?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message