Android Calendar Compare isSameInstant(Calendar cal1, Calendar cal2)

Here you can find the source of isSameInstant(Calendar cal1, Calendar cal2)

Description

is Same Instant

Declaration

public static boolean isSameInstant(Calendar cal1, Calendar cal2) 

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 w  w.j  a va 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. isAfterRollingTime(Calendar date)
  2. isAfterRollingTimeOut(Calendar date)
  3. isBeforeRollingEndTime(Calendar date)
  4. isBeforeRollingTime(Calendar date)
  5. isSameDay(Calendar calSource, Calendar calDesti)
  6. isSameLocalTime(Calendar calSource, Calendar calDesti)
  7. compare(Calendar d1, Calendar d2)
  8. getDateDelta(int delta, String dateFormat)
  9. isDateInInterval(Calendar date, int interval, TimeUnit type)