KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How would you rewrite the method below, which returns the first day of next month, with the org.joda.time package in Joda-Time ? public static Date firstDayOfNextMonth() { Calendar nowCal = Calendar.getInstance(); int month = nowCal.get(Calendar.MONTH) + 1; int year = nowCal.get(Calendar.YEAR); Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DAY_OF_MONTH, 1); Date dueDate = new Date(cal.getTimeInMillis()); return dueDate; }
Tags (comma-separated)
Save Edits
Cancel