Java Today isBeforeToday(Date date)

Here you can find the source of isBeforeToday(Date date)

Description

is Before Today

License

Apache License

Declaration

public static Boolean isBeforeToday(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {

    public static Boolean isBeforeToday(Date date) {
        Long dateTime = date.getTime();
        Long startTodayTime = getStartOfToday().getTime();
        if (dateTime < startTodayTime) {
            return true;
        } else {/*  w  w w.  j  ava  2 s .c  o m*/
            return false;
        }
    }

    public static Date getStartOfToday() {
        Calendar today = Calendar.getInstance();
        int year = today.get(Calendar.YEAR);
        int month = today.get(Calendar.MONTH);
        int day = today.get(Calendar.DAY_OF_MONTH);
        return new GregorianCalendar(year, month, day, 0, 0, 0).getTime();
    }
}

Related

  1. getTodayZero()
  2. getTodayZeroHour()
  3. getTommorrow(String today)
  4. getYestoday()
  5. getYestoday(String sourceDate, String format)
  6. isBeforeToday(Date date)
  7. isGreaterThanToday(String dateString)
  8. isToday(Date d1)
  9. isToday(Date date)