List of utility methods to do Day of
String | getSpecifiedDayAfter(String specifiedDay) get Specified Day After Calendar c = Calendar.getInstance(); Date date = null; date = new SimpleDateFormat("yy-MM-dd").parse(specifiedDay); c.setTime(date); int day = c.get(Calendar.DATE); c.set(Calendar.DATE, day + 1); String dayAfter = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); return dayAfter; ... |
Date | getSpecifiedDayAfter(String specifiedDay, int afterDay) get Specified Day After Calendar c = Calendar.getInstance(); Date date = null; try { date = new SimpleDateFormat("yyyy-MM-dd").parse(specifiedDay); } catch (ParseException e) { e.printStackTrace(); c.setTime(date); ... |
Date | getSpecifiedDayTimeAfter(Date date) get Specified Day Time After Calendar c = Calendar.getInstance(); c.setTime(date); int day = c.get(Calendar.DATE); c.set(Calendar.DATE, day + 1); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); return c.getTime(); ... |
String | getStandardDayFormat(Date day) get Standard Day Format return gStandardDayFormat.format(day);
|
String | getStartDate(int days, String strEndDate) get Start Date Calendar endCal = Calendar.getInstance(); Date endDate = stringToDate(strEndDate, STRING_DATE_FORMAT); endCal.setTime(endDate); endCal.add(Calendar.DATE, -days); SimpleDateFormat sdf = new SimpleDateFormat(STRING_DATE_FORMAT); return sdf.format(endCal.getTime()); |
Date | getStartDateByDays(Date endDate, int days) get Start Date By Days Calendar calendarEndDate = Calendar.getInstance();
calendarEndDate.setTime(endDate);
calendarEndDate.add(Calendar.DAY_OF_YEAR, 0 - days);
return calendarEndDate.getTime();
|
String | getStringAfterNDay(String str, int n) get String After N Day Calendar ca = parseStringToCalendar(str); if (ca == null) { return null; ca.add(Calendar.DATE, n); String strDate = ca.get(Calendar.YEAR) + "-"; int intMonth = ca.get(Calendar.MONTH) + 1; if (intMonth < 10) { ... |
String | getStringDay(Calendar cal) get String Day return new SimpleDateFormat("dd").format(cal.getTime()); |
String | getTargetDay(String day, int beforeOrAfterDays) get Target Day SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); Date date = null; Date targetDate = null; try { date = sdf.parse(day); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, beforeOrAfterDays); ... |
Date | getTheDayBefore(Date date) get The Day Before return new Date(date.getTime() - (long) 24 * (long) 60 * 60 * 1000); |