Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Calendar;

public class Main {
    private static final long MS_OF_ONE_DAY = (24 * 60 * 60 * 1000);

    public static int intervalDayBetweenDate(Calendar cl1, Calendar cl2) {
        long interval = 0;

        if (cl1.after(cl2)) {
            interval = cl1.getTimeInMillis() - cl2.getTimeInMillis();
        } else {
            interval = cl2.getTimeInMillis() - cl1.getTimeInMillis();
        }

        return (int) (interval / MS_OF_ONE_DAY);
    }
}