public static Date getNextMonth() { Date current = new Date(); Calendar c = Calendar.getInstance(); c.setTime(current); c.add(Calendar.MONTH, 1); c.set(Calendar.DATE, 1); c.set(Calendar.HOUR, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); return c.getTime(); } Date nextMonth = getNextMonth(); System.out.println(nextMonth);
No comments:
Post a Comment