Java Utililty Methods Day of

List of utility methods to do Day of

Description

The list of methods to do Day of are organized into topic(s).

Method

StringToEnglishDayWithMon(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);
Calendartomorrow(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;
StringtoNextDayYMD()
to Next Day YMD
final Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -1);
return new SimpleDateFormat("yyyyMMdd").format(calendar.getTime());
StringtoUtcDay(Date d)
Convert to a UTC date string containing only the day (granularity is "day").
return newDateFormat().format(d);
DatetruncateToBeginOfDay(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.");