Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {

    public static boolean IsDiferentDate(Date date1, Date date2) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date1);
        int daysInYear1 = calendar.get(Calendar.DAY_OF_YEAR);

        calendar = Calendar.getInstance();
        calendar.setTime(date2);
        int daysInYear2 = calendar.get(Calendar.DAY_OF_YEAR);

        if (daysInYear1 != daysInYear2 || date1.getYear() != date2.getYear()) {
            return true;
        }

        return false;
    }
}