List of utility methods to do Date to Quarter
int | getQuarterYear(Date dateParam) get Quarter Year if (dateParam == null) { throw new IllegalArgumentException("The dateParam must not be null"); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(dateParam.getTime()); return cal.get(Calendar.MONTH) / 3 + 1; |
Date | getQuaterStart(Date date) get Quater Start Calendar cal = cal(date, 0, 0); int quater = cal.get(MONTH) / 3; cal.set(MONTH, quater * 3); cal.set(DATE, 1); return cal.getTime(); |