List of utility methods to do Month Format
String | getAfterByNMonth(String format, int months) get After By N Month Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.add(Calendar.MONTH, months); Date newDate = c.getTime(); return formatDate(newDate, format); |
String | getCurrMonthFirstDaySlashFormat() get Curr Month First Day Slash Format Calendar calendar = Calendar.getInstance(); Date d = new Date(); calendar.setTime(d); calendar.set(Calendar.DATE, 1); return dateSlashFormat(calendar.getTime()); |
List | getDisplayMonth(Date time, int monthBefore, int monthAfter, SimpleDateFormat format) get Display Month ArrayList result = new ArrayList(); Calendar calendar = Calendar.getInstance(); if (null != time) { calendar.setTimeInMillis(time.getTime()); SimpleDateFormat tmpformat = format; if (null == tmpformat) { tmpformat = new SimpleDateFormat("yyyy/MM"); ... |
String | getFirstDayOfNextMonth(String dateFormat) get First Day Of Next Month String strDate = null; try { Calendar c = new GregorianCalendar(); SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat(dateFormat); c.roll(Calendar.MONTH, 1); c.set(GregorianCalendar.DAY_OF_MONTH, 1); strDate = mSimpleDateFormat.format(c.getTime()); } catch (Exception e) { ... |
String | getFormatCurMonthAsYYYYMM() get Format Cur Month As YYYYMM return yyyymm.format(currentDate());
|
String | getLastYearMonthYYYYMM() get Last Year Month YYYYMM Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); SimpleDateFormat simpleFormate = new SimpleDateFormat("yyyyMM"); return simpleFormate.format(calendar.getTime()).trim(); |
String | getMonthFormat(String dateString) get Month Format int start = 0; int to = dateString.lastIndexOf("."); return dateString.substring(start, to); |
Date | getUpMonthDate(String date, String dateFormat) get Up Month Date Calendar c = new GregorianCalendar(); c.setTime(strToDate(date, dateFormat)); c.add(Calendar.MONTH, -1); return c.getTime(); |
String | getYesterMonthDate(String format) get Yester Month Date Calendar day = Calendar.getInstance(); day.add(Calendar.MONTH, -1); SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(day.getTime()); |
int | monthsBetween(String from, String to, String format) months Between SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.UK); Calendar calendar = Calendar.getInstance(Locale.UK); calendar.setFirstDayOfWeek(Calendar.MONDAY); calendar.setMinimalDaysInFirstWeek(4); Date fromDate = null; Date toDate = null; try { fromDate = formatter.parse(from); ... |