Well, OK, perhaps not...
However, beware the Java Calendar object. While DATE and YEAR are 1 based, MONTH is zero based! If you're just doing a comparison with a known month, no problem. However, if you're expecting a useful int value for construction a date string (like say for passing to a SQL server as part of a query), you may meet with a most unpleasant surprise.
It appears that MONTH was just designed with direct comparisons in mind. However, there is no other decent way to get a MONTH int out of the object, and building a big case to figure it out is just silly. Sure wish they would have just made it 1 based and avoided this goofiness...
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5