Friday, March 10, 2006

Potential calendar problem in Java!

Java has a GregorianCalendar class (representing a data's year, month, day, etc.) with a get method that takes an integer argument and returns things like that instance's year as an int value. This means that the value returned will be invalid for year values beyond 2,147,483,647 (the maximum value of a Java int)! I think that's the time in Babylon 5 where humans escaped their physical bodies and left our solar system to avoid the impending explosion of the sun. Seriously, of more concern to me is the pain in the neck date and number parsing and formatting is in Java. Arggh! Things like this bug me:
int remainder = new Double(
new Double(i).doubleValue(),
new Double(startMonth).doubleValue())/12
What about Ruby's
 (27 % 12).to_i
If that's syntactic sugar I'll risk the cavities.