List of utility methods to do Year Month
String | getYearMonthStr(Date parseDate) get Year Month Str return formatStr(parseDate, YYYYMMINTFORMAT);
|
String | getYearMonthString(Date date) Format the current year and month (YYYY-MM). return dfYearMonth.format(date);
|
int | lastDay(int year, int month) last Day int day = 0; switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: ... |
Date | makeDate(int day, int month, int year, int hour, int min, int sec) make Date DateFormat df1 = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String sdate = day + "-" + month + "-" + year + " " + hour + ":" + min + ":" + sec; Date date = df1.parse(sdate); return date; |
String | monthBeginDate(int year, int month) month Begin Date Calendar mth = Calendar.getInstance(); mth.set(Calendar.YEAR, year); mth.set(Calendar.MONTH, month - 1); mth.set(Calendar.DAY_OF_MONTH, 1); return (new SimpleDateFormat("yyyy-MM-dd").format(mth.getTime())); |
Date | newDate(int year, int month, int day) new Date return new Date(year - 1900, month - 1, day); |
String | normalizeShortDate(String year, String month, String day) normalize Short Date for (int i = year.length(); i < 4; i++) { year = "0" + year; if (month.length() < 2) month = "0" + month; if (day.length() < 2) day = "0" + day; return year + "-" + month + "-" + day; ... |
Date | parseMonthAndYearStringOrNull(String dateString) Parse the provided MM/yyyy Date string into a Date Object. return parseDate(MONTH_YEAR_DATE_FORMAT, dateString);
|
boolean | sameYearAndMonth(Date d1, Date d2) same Year And Month if (d1 == null || d2 == null) { return false; Calendar c1 = new GregorianCalendar(); c1.setTime(d1); Calendar c2 = new GregorianCalendar(); c2.setTime(d2); return c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR) && c1.get(Calendar.MONTH) == c2.get(Calendar.MONTH); ... |
String | toDateProgression(int year, int month, int day, String seed, int pedometer) to Date Progression GregorianCalendar dateAntetype = new GregorianCalendar(year, month - 1, day); if ("year".equals(seed)) dateAntetype.add(GregorianCalendar.YEAR, pedometer); else if ("month".equals(seed)) dateAntetype.add(GregorianCalendar.MONTH, pedometer); else if ("day".equals(seed)) dateAntetype.add(GregorianCalendar.DATE, pedometer); Date d = dateAntetype.getTime(); ... |