List of utility methods to do Today
String | todayAsSimpleIsoDate(Date date) Today as simple iso date. Format formatter = new SimpleDateFormat("yyyyMMdd"); return formatter.format(date); |
String | todayAsXSDDateString() today As XSD Date String return calendarToXSDDateString(new GregorianCalendar()); |
Date | todayAtDayEnd() today At Day End final Calendar cal = Calendar.getInstance(); cal.setTime(new Date(System.currentTimeMillis())); adjustToDayEnd(cal); return cal.getTime(); |
String | todayDate() today Date Calendar now = Calendar.getInstance(); now.setTime(new java.util.Date()); return String.valueOf(now.get(Calendar.DAY_OF_MONTH)) + "-" + String.valueOf(now.get(Calendar.MONTH) + 1) + "-" + String.valueOf(now.get(Calendar.YEAR)); |
int | todayMinute() today Minute Calendar c = Calendar.getInstance(); int hh = c.get(Calendar.HOUR_OF_DAY); int mm = c.get(Calendar.MINUTE); return hh * 60 + mm; |
Date | todayPlusDays(int days) today Plus Days Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); calendar.add(Calendar.DATE, days); return calendar.getTime(); |
Date | toDaysBeforeOrAfter(Date date, Integer days) to Days Before Or After return add(date, Calendar.DAY_OF_YEAR, days);
|
String | todaysDate(int style) Get today's date in various formats style=0 -> ddMMyyyy style=1 -> YYYY-MM-dd style=2 -> dd-MMM-YYY Date date = new Date(); SimpleDateFormat formatterOut = null; if (style == 0) { formatterOut = new SimpleDateFormat("ddMMMyyyy"); } else if (style == 1) { formatterOut = new SimpleDateFormat("yyyy-MM-dd"); } else if (style == 2) { formatterOut = new SimpleDateFormat("dd-MMM-yyyy"); ... |
String | todaySortedTimestamp() today Sorted Timestamp return sortedTimestampFormat(today());
|
Date | todayStart() today Start return getDateWithoutTimePart(new Date()); |