List of utility methods to do Day of
String | ToEnglishDayWithMon(Date dt) To English Day With Mon if (dt == null) return ""; DateFormatSymbols sym = new DateFormatSymbols(); sym.setMonths(MONTHS); SimpleDateFormat f = new SimpleDateFormat("dd MMM, yyyy", sym); return getWeekDay(dt) + ", " + f.format(dt); |
Calendar | tomorrow(int dayafter) tomorrow Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, dayafter + 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal;
|
String | toNextDayYMD() to Next Day YMD final Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, -1); return new SimpleDateFormat("yyyyMMdd").format(calendar.getTime()); |
String | toUtcDay(Date d) Convert to a UTC date string containing only the day (granularity is "day"). return newDateFormat().format(d);
|
Date | truncateToBeginOfDay(Date date) Returns a normalized version of the given date. String normalized = yyyMMddFormat.format(date); try { return yyyMMddFormat.parse(normalized); } catch (ParseException e) { throw new AssertionError("Bug in SimpleDateFormat. Produces String it cannot parse."); |