获得指定日期区间内的年份和季节<br>

@param startDate 起始日期（包含）
@param endDate 结束日期（包含）
@return 季度列表 ，元素类似于 20132
508476
public static LinkedHashSet<String> yearAndQuarter(Date startDate, Date endDate) {
		if (startDate == null || endDate == null) {
			return new LinkedHashSet<String>(0);
		}
		return yearAndQuarter(startDate.getTime(), endDate.getTime());
	}
89089
public Expression<java.sql.Date> between(java.sql.Date startValue, java.sql.Date endValue) {
		SimpleDateFormat formatter = getDateFormatter();
		String valueString = "'" + formatter.format(startValue).concat("Z") + "' AND '" + formatter.format(endValue) + "'";
		return new Expression<java.sql.Date>(this, Operation.between, valueString);
	}
371671
public static List<String> getDayListBetween2Day(String startDate, String endDate, Format format) {
        List<String> dayList = new ArrayList<String>();
        int dataNum = Integer.parseInt(getTwoDay2String(startDate, endDate, format));
        for (int i = 0; i < (dataNum + 1); i++) {
            String resultDate = getNextDay2String(startDate, String.valueOf(i), format);
            dayList.add(resultDate);
        }
        return dayList;
    }
252156
@Override
	public double getDaycountFraction(LocalDate startDate, LocalDate endDate) {
		if(startDate.isAfter(endDate)) {
			return -getDaycountFraction(endDate,startDate);
		}

		/*
		 * Number of whole years between start and end, excluding start's year and excluding end's year.
		 *
		 * If start and end fall in the same year, this is -1 (there will be a double counting of 1 year below if start < end).
		 * If start and end fall in separate but consecutive years, this is 0 (for start and end the fractional parts are counted individually below).
		 */
		double daycountFraction = endDate.getYear() - startDate.getYear() - 1.0;

		/*
		 * Fraction from start to the end of start's year
		 */
		LocalDate startDateNextYear = LocalDate.of(startDate.getYear()+1,Month.JANUARY,1);

		if(isCountLastDayNotFirst) {
			startDateNextYear = startDateNextYear.minusDays(1);
		}

		daycountFraction += getDaycount(startDate, startDateNextYear) / startDate.lengthOfYear();

		/*
		 * Fraction from beginning of end's year to end
		 */
		LocalDate endDateStartYear = LocalDate.of(endDate.getYear(), Month.JANUARY, 1);
		if (isCountLastDayNotFirst) {
			endDateStartYear = endDateStartYear.minusDays(1);
		}


		daycountFraction += getDaycount(endDateStartYear, endDate) / endDate.lengthOfYear();

		return Math.max(daycountFraction,0.0);
	}
724054
public static function initDatesInRange($start_date, $end_date, $daysDifference = 1){
        $dates_in_range = [];
        $begin = new DateTime($start_date);
        $end = new DateTime($end_date);
        $endModify = $end->modify( '+'.$daysDifference.' day' ); 

        $interval = new DateInterval('P'.$daysDifference.'D');
        $daterange = new DatePeriod($begin, $interval ,$endModify);

        foreach($daterange as $date){
            $dates_in_range[$date->getTimestamp()] = $date->format("Y-m-d");
        }
        return $dates_in_range;
    }
483242
@Override
	public double getDaycount(LocalDate startDate, LocalDate endDate) {
		if(startDate.isAfter(endDate)) {
			return -getDaycount(endDate,startDate);
		}

		int startDateDay 	= startDate.getDayOfMonth();
		int startDateMonth 	= startDate.getMonthValue();
		int startDateYear 	= startDate.getYear();

		int endDateDay 		= endDate.getDayOfMonth();
		int endDateMonth 	= endDate.getMonthValue();
		int endDateYear 	= endDate.getYear();

		if(
				isEndOfMonth &&
				startDate.getMonth() == Month.FEBRUARY &&
				startDate.getDayOfMonth() == startDate.lengthOfMonth() &&
				endDate.getMonth() == Month.FEBRUARY &&
				endDate.getDayOfMonth() == endDate.lengthOfMonth()
				) {
			endDateDay = 30;
		}

		if(
				isEndOfMonth &&
				startDate.getMonth() == Month.FEBRUARY &&
				startDate.getDayOfMonth() == startDate.lengthOfMonth()
				) {
			startDateDay = 30;
		}

		if(endDateDay > 30 && startDateDay >= 30) {
			endDateDay = 30;
		}
		startDateDay = Math.min(startDateDay,30);

		return (endDateYear - startDateYear) * 360.0 + (endDateMonth - startDateMonth) * 30.0 + (endDateDay - startDateDay);
	}
661640
@Override
    public Date firstBetween(Date start, Date end)
    {
        return doFirstBetween(start, end);
    }
34012
public static Date getRandomDate(Date begin, Date end) {
		return getRandomDate(begin, end, r);
	}
275532
public static java.sql.Date rollMonths(java.util.Date startDate, int months) {
        return rollDate(startDate, Calendar.MONTH, months);
    }
1338627
public static boolean isBetweenDate(String startDate, String endDate, Format format, String specificDate) {
        boolean result = false;
        List<String> dateList = getDayListBetween2Day(startDate, endDate, format);
        for (String date : dateList) {
            if (date.equalsIgnoreCase(specificDate)) {
                return true;
            }
        }
        return result;
    }
1239283
public Date getEndDate()
    {
        if ((m_startTime != null) && (m_endTime != null))
        {
            if (m_endTime.before(m_startTime))
                return m_startTime;
        }
        return m_endTime;
    }
820873
public static long betweenMs(Date beginDate, Date endDate) {
		return new DateBetween(beginDate, endDate).between(DateUnit.MS);
	}
120534
public static function getMonthsRange($startData, $endDate) {
        $time1 = strtotime($startData); //absolute date comparison needs to be done here, because PHP doesn't do date comparisons
        $time2 = strtotime($endDate);
        //$my1 = date('mY', $time1); //need these to compare dates at 'month' granularity
        //$my2 = date('mY', $time2);
        $year1 = date('Y', $time1);
        $year2 = date('Y', $time2);
        $years = range($year1, $year2);
        $months = Array();
        foreach ($years as $year) {
            $months[$year] = array();
            while ($time1 < $time2) {
                if (date('Y', $time1) == $year) {
                    $months[$year][] = date('m', $time1);
                    $time1 = strtotime(date('Y-m-d', $time1) . ' +1 month');
                } else {
                    break;
                }
            }
            continue;
        }

        return $months;
    }
162164
public static long between(Date beginDate, Date endDate, DateUnit unit, boolean isAbs) {
		return new DateBetween(beginDate, endDate, isAbs).between(unit);
	}
1238098
public com.google.api.ads.admanager.axis.v201805.Date getEndDate() {
        return endDate;
    }
864290
public static boolean isBetween(final Date start, final Date end, final Date between)
	{
		final long min = start.getTime();
		final long max = end.getTime();
		final long index = between.getTime();
		return min <= index && index <= max;
	}
1244310
public function getParticipationsByDayByRangeDate($startDate = '', $endDate = '')
    {
        $em = $this->getServiceManager()->get('doctrine.entitymanager.orm_default');
        $emConfig = $em->getConfiguration();
        $emConfig->addCustomDatetimeFunction('DATE', '\DoctrineExtensions\Query\Mysql\Date');

        $startDateTime = \DateTime::createFromFormat('d/m/Y', $startDate);
        $endDateTime = \DateTime::createFromFormat('d/m/Y', $endDate);

        if ($startDate != '' && $endDate != '') {
            $dateRange = "(e.created_at >='" . $startDateTime->format('Y-m-d') . " 0:0:0' AND e.created_at <= '" . $endDateTime->format('Y-m-d') . " 23:59:59')";
        } elseif ($startDate == '' && $endDate != '') {
            $dateRange = "e.created_at <= '" . $endDateTime->format('Y-m-d') . " 23:59:59'";
        } elseif ($startDate != '' && $endDate == '') {
            $dateRange = "e.created_at >='" . $startDateTime->format('Y-m-d') . " 0:0:0'";
        } else {
            $dateRange = "e.created_at IS NOT NULL";
        }

        $query = $em->createQuery('
            SELECT DATE(e.created_at) as date, COUNT(e.id) as qty FROM PlaygroundGame\Entity\Entry e
			WHERE ' . $dateRange . '
            AND e.active=0
            GROUP BY date
        ');
        $result = $query->getResult();
        return $result;
    }