Java Date Compare compareDateForSecond(Date src, Date target, int second)

Here you can find the source of compareDateForSecond(Date src, Date target, int second)

Description

compare Date For Second

License

Open Source License

Declaration

public static boolean compareDateForSecond(Date src, Date target,
        int second) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static boolean compareDateForSecond(Date src, Date target,
            int second) {
        Calendar targetTime = Calendar.getInstance();
        targetTime.setTime(target);/*from   w ww.  j av a2 s. c  o  m*/
        targetTime.add(Calendar.SECOND, second);
        Calendar srcTime = Calendar.getInstance();
        srcTime.setTime(src);
        return srcTime.compareTo(targetTime) <= 0;
    }
}

Related

  1. compareDate(String startdate, String enddate)
  2. compareDate(String startDate, String endDate, String strFormat)
  3. compareDate(String strDate1, String strDate2, String format)
  4. compareDate2(String begingDate, String endDate, String format)
  5. compareDateFormat(String strDate1, String strDate2, String format)
  6. compareDates(Date date1, Date date2)
  7. compareDates(Date date1, Date date2)
  8. compareDates(final Date dateA, final Date dateB)
  9. compareDates(final String format, final Date date1, final Date date2)