• Post Reply Bookmark Topic Watch Topic
  • New Topic

fields in Calendar after deserialization ??  RSS feed

 
Christopher Arthur
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting something strange here.
I serialized some GregorianCalendar classes, and when I bring them back into memory, the MONTH field ends up in some cases having a ridiculously high value > 12. If that wasn't weird enough, it happens when I use the get() method, but if I send the date to a DateFormat, the output seems correct.
What's going on here?
 
Christopher Arthur
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, silly me...when I was getting the month value, I had

gc.get(GregorianCalendar.MONTH+1)

instead of

gc.get(GregorianCalendar.MONTH)+1

Duh!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!