Java Day End isEqualYMD(Date begindate, Date enddate)

Here you can find the source of isEqualYMD(Date begindate, Date enddate)

Description

add by xie compare date only compare year month day

License

Open Source License

Parameter

Parameter Description
begindate begin date
enddate end date

Return

begindate > endate as false

Declaration

public static boolean isEqualYMD(Date begindate, Date enddate) 

Method Source Code


//package com.java2s;
/*/*from ww  w .jav  a2s .c  o m*/
 * File: $RCSfile$
 *
 * Copyright (c) 2005 Wincor Nixdorf International GmbH,
 * Heinz-Nixdorf-Ring 1, 33106 Paderborn, Germany
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information
 * of Wincor Nixdorf ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered
 * into with Wincor Nixdorf.
 */

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

public class Main {
    /**
     * add by xie compare date only compare year month day
     *
     * @param begindate begin date
     * @param enddate   end date
     * @return begindate > endate as false
     */
    public static boolean isEqualYMD(Date begindate, Date enddate) {
        boolean isEquals = true;
        Calendar startCalendar = Calendar.getInstance();
        startCalendar.setTime(begindate);
        Calendar endCalendar = Calendar.getInstance();
        endCalendar.setTime(enddate);
        int startYear = startCalendar.get(Calendar.YEAR);
        int startMonth = startCalendar.get(Calendar.MONTH);
        int startDay = startCalendar.get(Calendar.DATE);
        int endYear = endCalendar.get(Calendar.YEAR);
        int endMonth = endCalendar.get(Calendar.MONTH);
        int endDay = endCalendar.get(Calendar.DATE);
        if (startYear != endYear || startMonth != endMonth || startDay != endDay) {
            isEquals = false;
        }
        return isEquals;
    }
}

Related

  1. isCalenderDaySame(GregorianCalendar aInCal1, GregorianCalendar aInCal2)
  2. isEndOfMonth(Date d)
  3. isEndOfMonth(Date date)
  4. isEndOfMonth(Date nowday)
  5. isEndOfSeason(Date date)
  6. isIncludeDay(Date start, Date end, Date target)
  7. isInRange(Date myDate, Date dateStart, Date dateEnd)
  8. isInWorkDay(Calendar start)
  9. isMoreThenMonth(Date startDate, Date enDate)