Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;

public class Main {

    public static int isInSameDay(long day1, long day2) {
        Calendar c1 = Calendar.getInstance();
        c1.setTimeInMillis(day1);
        Calendar c2 = Calendar.getInstance();
        c2.setTimeInMillis(day2);
        if (c1.get(Calendar.DAY_OF_YEAR) == c2.get(Calendar.DAY_OF_YEAR))
            return 0;
        else {
            return c1.get(Calendar.DAY_OF_YEAR) > c2.get(Calendar.DAY_OF_YEAR) ? 1 : -1;
        }

    }
}