List of utility methods to do Today
String | getYestoday(String sourceDate, String format) get Yestoday return getFormatDateAdd(getDateFromString(sourceDate, format), -1, format);
|
Boolean | isBeforeToday(Date date) is Before Today Long dateTime = date.getTime(); Long startTodayTime = getStartOfToday().getTime(); if (dateTime < startTodayTime) { return true; } else { return false; |
boolean | isBeforeToday(Date date) is Before Today return date.compareTo(getToday()) < 0;
|
boolean | isGreaterThanToday(String dateString) is Greater Than Today try { if (dateString.trim().length() < 12) { dateString += " 00:00:00"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date dueDate = sdf.parse(dateString); GregorianCalendar calendar = new GregorianCalendar(); Date today = calendar.getTime(); ... |
boolean | isToday(Date d1) test a date represents todays date return sameDay(d1, new Date()); |
boolean | isToday(Date date) is Today Date now = onlyDate(new Date()); Date d = onlyDate(date); return now.equals(d); |
boolean | isToday(Date date) is Today if (date == null) { return false; String dateAsText = toDateText(date); String todayAsText = toDateText(now()); return dateAsText.equals(todayAsText); |
boolean | isToday(Date date, TimeZone timezone) Returns true if date is today. Date now = new Date(); SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); if (timezone != null) { df.setTimeZone(timezone); return df.format(now).equals(df.format(date)); |
boolean | isToday(Date dateTime) is Today Calendar someCa = GregorianCalendar.getInstance(); someCa.setTime(dateTime); int syear = someCa.get(Calendar.YEAR); int smonth = someCa.get(Calendar.MONTH); int sday = someCa.get(Calendar.DAY_OF_YEAR); Calendar currentCa = GregorianCalendar.getInstance(); int cyear = currentCa.get(Calendar.YEAR); int cmonth = currentCa.get(Calendar.MONTH); ... |
boolean | isToday(final Date date) is Today final Calendar calendar = Calendar.getInstance(); calendar.setTime(date); final int year = calendar.get(YEAR); final int month = calendar.get(MONTH); final int day = calendar.get(DAY); final Calendar today = Calendar.getInstance(); today.setTime(now()); final int tyear = today.get(YEAR); ... |