Sunday March 23, 2008
java.util.GregorianCalendar sucks
I have seen two bugs lately, which were directly related to the GregorianCalendar:
- GregorianCalendar and XMLGregorianCalendar count the time differently. While XMLGregorianCalendar starts counting the months with ‘1′, the standard GregorianCalendar starts with ‘0′.
- If you use GregorianCalendar.HOUR, this will make the
GregorianCalendar to use a 12-hour clock, which resulted in a bug which only occured after midday.
While these quirks can be considered as must-have knowledge for a Java
developer, they still suck.
As a result of these bugs, I have started introducing Joda-time in some of projects I work on. This is probably not big news for some of you, but it seems that Joda-time is much easier to use.
What are your experiences with Joda-time?
Posted on Mar 23, 2008 at 19:50 (MET) | Permalink | 4 comments