Java Calendar Different countDiffDay(Calendar c1, Calendar c2)

Here you can find the source of countDiffDay(Calendar c1, Calendar c2)

Description

count Diff Day

License

Open Source License

Declaration

public static int countDiffDay(Calendar c1, Calendar c2) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {
    public static int countDiffDay(Calendar c1, Calendar c2) {
        int returnInt = 0;
        while (!c1.after(c2)) {
            c1.add(Calendar.DAY_OF_MONTH, 1);
            returnInt++;/*from www  . j  a  va 2s. c  o m*/
        }

        if (returnInt > 0) {
            returnInt = returnInt - 1;
        }

        return (returnInt);
    }
}

Related

  1. countDiffMonth(Calendar cBegin, Calendar cEnd, boolean isRoundUp)
  2. datediff(Calendar c1, Calendar c2)
  3. dateDiff(int type, Calendar fromDate, Calendar toDate)
  4. dateDiff(int type, Calendar fromDate, Calendar toDate, boolean future)