Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Date;

public class Main {
    /**
     * Tests if the given base date is strictly between the given start date and
     * end date.
     *
     * @param baseDate  the date used as base for the test.
     * @param startDate the start date.
     * @param endDate   the end date.
     * @return <code>true</code> if the base date is between the start date
     * and end date, <code>false</code> otherwise.
     */
    public static boolean strictlyBetween(Date baseDate, Date startDate, Date endDate) {
        if (startDate.equals(endDate) || endDate.before(startDate)) {
            return false;
        }

        if (startDate.before(baseDate) && endDate.after(baseDate)) {
            return true;
        }

        return false;
    }
}