Java Date Compare by Day isSameDay(Date lastUpgradeTime)

Here you can find the source of isSameDay(Date lastUpgradeTime)

Description

is Same Day

License

Apache License

Declaration

public static boolean isSameDay(Date lastUpgradeTime) 

Method Source Code

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

import java.util.Calendar;
import java.util.Date;

public class Main {

    public static boolean isSameDay(Date lastUpgradeTime) {
        Calendar now = Calendar.getInstance();
        Calendar lastUpgrade = Calendar.getInstance();
        lastUpgrade.setTime(lastUpgradeTime);
        if (now.get(Calendar.DATE) == lastUpgrade.get(Calendar.DATE)) {
            return true;
        }//  ww  w.  j  av  a2 s . c om
        return false;
    }

    public static boolean isSameDay(long lastUpgradeTime) {
        Calendar now = Calendar.getInstance();
        Calendar lastUpgrade = Calendar.getInstance();
        lastUpgrade.setTimeInMillis(lastUpgradeTime);
        return now.get(Calendar.DATE) == lastUpgrade.get(Calendar.DATE);
    }
}

Related

  1. isSameDay(Date date)
  2. isSameDay(Date date1, Date date2)
  3. isSameDay(Date date1, Date date2)
  4. isSameDay(Date date1, Date date2)
  5. isSameDay(Date day1, Date day2)
  6. isSameDay(final Date date1, final Date date2)
  7. isSameDayWithToday(Date date)
  8. sameDay(Date date1, Date date2)
  9. sameDay(Date date1, Date date2)