Android Calendar Compare compare(Calendar d1, Calendar d2)

Here you can find the source of compare(Calendar d1, Calendar d2)

Description

compare

Declaration

public static int compare(Calendar d1, Calendar d2) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {
    public static int compare(Calendar d1, Calendar d2) {
        int result = 0;

        if (d1 == null && d2 == null)
            return result;
        if (d1 == null)
            return -1;
        if (d2 == null)
            return 1;

        if (d1.after(d2))
            result = 1;//from w  ww . j  a v  a2 s  .co  m
        else if (d1.before(d2))
            result = -1;
        else
            result = 0;

        return result;
    }
}

Related

  1. isBeforeRollingEndTime(Calendar date)
  2. isBeforeRollingTime(Calendar date)
  3. isSameDay(Calendar calSource, Calendar calDesti)
  4. isSameInstant(Calendar cal1, Calendar cal2)
  5. isSameLocalTime(Calendar calSource, Calendar calDesti)
  6. getDateDelta(int delta, String dateFormat)
  7. isDateInInterval(Calendar date, int interval, TimeUnit type)
  8. isCurrentTimeInRange(Calendar now, Calendar start, Calendar end)
  9. isFiveMinutesOlder(Calendar updatedAt)