Android Date Compare isSameInstant(Date date1, Date date2)

Here you can find the source of isSameInstant(Date date1, Date date2)

Description

is Same Instant

Declaration

public static boolean isSameInstant(Date date1, Date date2) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static boolean isSameInstant(Date date1, Date date2) {
        if (date1 == null || date2 == null) {
            throw new IllegalArgumentException("The date must not be null");
        }/*from  w ww.  j a  v a 2s .  co m*/
        return date1.getTime() == date2.getTime();
    }

    public static boolean isSameInstant(Calendar cal1, Calendar cal2) {
        if (cal1 == null || cal2 == null) {
            throw new IllegalArgumentException("The date must not be null");
        }
        return cal1.getTime().getTime() == cal2.getTime().getTime();
    }
}

Related

  1. compareDate(Date date1, Date date2, int what)
  2. compareDate(String date1, String date2, int what)
  3. dateAfterDate(Date date, long days)
  4. dateBeforeDate(Date date, long days)
  5. isSameDay(Date dateSource, Date dateDesti)
  6. needsMidnightCountdown()
  7. dateDiffer(Date date1, Date date2)
  8. compare(Date date1, Date date2)
  9. compare(String date0, String date1, String format)