Java Utililty Methods Today

List of utility methods to do Today

Description

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

Method

booleanisToday(final Date date)
is Today
if (date == null) {
    return false;
return !isInPast(date) && !isInFuture(date);
booleanisToday(final Date date)
is Today
final Calendar now = Calendar.getInstance();
final Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
now.set(Calendar.HOUR_OF_DAY, 0);
now.set(Calendar.MINUTE, 0);
now.set(Calendar.SECOND, 0);
now.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.HOUR_OF_DAY, 0);
...
booleanisToday(int dateInt)
is Today
Calendar nowCal = GregorianCalendar.getInstance();
nowCal.setTime(new Date());
Calendar compareCal = convertToCal(dateInt);
return nowCal.get(Calendar.DAY_OF_MONTH) == compareCal.get(Calendar.DAY_OF_MONTH)
        && nowCal.get(Calendar.MONTH) == compareCal.get(Calendar.MONTH)
        && nowCal.get(Calendar.YEAR) == compareCal.get(Calendar.YEAR);
booleanisToDay(long millis)
is To Day
Calendar now = Calendar.getInstance();
Calendar compare = Calendar.getInstance();
compare.setTimeInMillis(millis);
if (now.get(Calendar.YEAR) != compare.get(Calendar.YEAR))
    return false;
if (now.get(Calendar.DAY_OF_YEAR) != compare.get(Calendar.DAY_OF_YEAR))
    return false;
return true;
...
booleanisToday(long milliseconds)
is Today
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(milliseconds);
if (getCurrentMonth() == getMonth(milliseconds) && getCurrentDay() == getDay(milliseconds)) {
    return true;
return false;
booleanisToday(long timestamp)
is Today
Calendar calendar = Calendar.getInstance();
int date = calendar.get(Calendar.DATE);
int month = calendar.get(Calendar.MONTH);
int year = calendar.get(Calendar.YEAR);
calendar.setTimeInMillis(timestamp);
int _date = calendar.get(Calendar.DATE);
int _month = calendar.get(Calendar.MONTH);
int _year = calendar.get(Calendar.YEAR);
...
booleanisToday(String depDateTime)
Is a dateTime today
boolean isToday = false;
Calendar depDate = parseCalendarString(depDateTime);
int depDay = depDate.get(Calendar.DAY_OF_MONTH);
Calendar now = getTimeNow();
int nowDay = now.get(Calendar.DAY_OF_MONTH);
if (depDay == nowDay) {
    isToday = true;
return isToday;
booleanisToday(String sdate)
is Today
boolean b = false;
Date time = toDate(sdate);
Date today = new Date();
if (time != null) {
    String nowDate = dateFormater2.format(today);
    String timeDate = dateFormater2.format(time);
    if (nowDate.equals(timeDate)) {
        b = true;
...
booleanisToday(String sdate)
is Today
boolean b = false;
Date time = toDate(sdate);
Date today = new Date();
if (time != null) {
    String nowDate = DATE_FORMATER_2.get().format(today);
    String timeDate = DATE_FORMATER_2.get().format(time);
    if (nowDate.equals(timeDate)) {
        b = true;
...
StringparseToday(String s)
parse Today
if (s == null) {
    return s;
Pattern pattern = Pattern.compile("today(?:\\s*\\-\\s*(\\d+))?");
Matcher matcher = pattern.matcher(s);
if (!matcher.matches()) {
    return s;
Calendar cal = Calendar.getInstance();
String n = matcher.group(1);
if (n != null) {
    cal.add(Calendar.DATE, -1 * Integer.parseInt(n));
return new SimpleDateFormat("yyyy/MM/dd").format(cal.getTime());