Usually, I was doing it like this:
DateFormat f = new SimpleDateFormat("yyyy-MM-dd");
Date d = f.parse("2012-12-21");
Calendar c = Calendar.getInstance();
c.setTime(d);
bean.setDate(c);
But I just found that working solution:
DateFormat f = new SimpleDateFormat("yyyy-MM-dd");
f.parse("2012-12-21");
bean.setDate(f.getCalendar());
Why nowhere in the doc, it is specified that parse()
(for exemple) keeps in mind the value after parsing instead of simply returning it? Is it a bad way to do? I feel like having been betrayed all these years long...