Java Date Between between(Date since, Date until, Date dateIn, Date dateOut)

Here you can find the source of between(Date since, Date until, Date dateIn, Date dateOut)

Description

between

License

Open Source License

Declaration

public static boolean between(Date since, Date until, Date dateIn, Date dateOut) 

Method Source Code

//package com.java2s;
/*/*ww  w. j av  a2s  .  co  m*/
 * Copyright (C) 2009-2015 SM2 SOFTWARE & SERVICES MANAGEMENT
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program has been created in the hope that it will be useful.
 * It is distributed WITHOUT ANY WARRANTY of any Kind,
 * without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/.
 *
 * For more information, please contact SM2 Software & Services Management.
 * Mail: info@talaia-openppm.com
 * Web: http://www.talaia-openppm.com
 *
 * Module: utils
 * File: DateUtil.java
 * Create User: javier.hernandez
 * Create Date: 06/03/2015 14:35:37
 */

import java.util.*;

public class Main {
    public static boolean between(Date since, Date until, Date dateIn, Date dateOut) {

        return between(dateIn, dateOut, since) || between(dateIn, dateOut, until)
                || (since.before(dateIn) && until.after(dateOut));
    }

    public static boolean between(Date since, Date until, Date date) {

        return date != null && (!since.after(date) && !until.before(date));
    }
}

Related

  1. between(Date beginDate, Date endDate)
  2. between(Date d, Date startDate, Date endDate)
  3. between(Date kezdet, Date veg, Date datum)
  4. between(Date smdate, Date bdate)
  5. betweenDate(String from, String to)
  6. betweenHour(Date date, int hour)
  7. betweenInDay(Date date, Date start, Date end)