It looks like nothing remains for java.util.Date to do. So should we leave it for dead and go on to other things? I don't know what is going on, but your snippet runs fine without exception and with the correct result?
It should, the format is also mentioned in the javadoc of the SimpleDateFormat class. No, java.util.Date still has an important role. A java.util.Date is a value object.
Code:
Date curDate = new Date();
Calendar pal = Calendar.getInstance();
pal.setTime(curDate);
int year = pal.get(Calendar.YEAR);
Bookmarks