Calendars, Dates, and TimeZones
In general, calendars are not easy to understand, develop, or to use. They are complex, created out of the need to understand and put order into celestial movements, seasons, religious events, and political decisions. It's a wonder that we stay on schedule for anything, and yet we do, and the world moves on, and we still are able to use the Java platform's Calendar and Date classes to properly handle date and time functions in our applications...despite the complaints against them.
I see a new JSR on the horizon, JSR 310: Date and Time API. I haven't been involved in that, but I'm confident it will help resolve some of the problems people have with the existing Calendar and Date API in the Java platform.
I can't complain about what we have today. I know the people that created these APIs, and I know their commitment and contributions. They've worked hard and have had to work under tremendous constraints that have limited their ability to implement perfect solutions. Just like real calendars, the existing Calendar and Date APIs have been influenced my many, many factors. So, until something better comes along that everyone agrees on, we have to work with what we have. For me, that's the core APIs...nothing against Joda or other products, nothing at all. However, I think the existing date and time support is usable.
In fact, I think it's time to help others resolve some of their concerns about the Calendar, Date, and TimeZone classes. If you have questions about these classes, I encourage you to email me (john at joconner dot com) or respond to this blog. I'm going to collect your comments and respond right here. Let's get rid of any confusions about these APIs and show some real solutions...these classes might just work better than you suspect. I'll devote the next few blogs to demonstrating best practices with these classes.