Monthly Archives: December 2007

Getting the day, month, and year from a date object

Now that convenient methods such as Date.getDay(), Date.getMonth(), and Date.getYear() are inconveniently deprecated, here’s the undeprecated way to get the day, month and year from a date object. GregorianCalendar cal = new GregorianCalendar();cal.setTime(someDate);int day = cal.get(Calendar.DAY_OF_WEEK);int month = cal.get(Calendar.MONTH);int year … Continue reading

Posted in Uncategorized | Leave a comment