将一个日期的月,日,时,分,秒,毫秒调整为最小值

@param calendar 一个日期
@return 被转化后的日期
@see #dateReservedYear000(Date)
769994
public static Date dateReservedYear000(Calendar calendar) {
        calendar.set(Calendar.MONTH, Calendar.JANUARY);
        calendar.set(Calendar.DAY_OF_MONTH, 1);

        return dateReservedDay000(calendar);
    }
324019
public static Date dateReservedQuarter000(int year, int quarter) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, year);
        if (quarter <= 1) {
            calendar.set(Calendar.MONTH, Calendar.JANUARY);
        } else if (quarter == 2) {
            calendar.set(Calendar.MONTH, Calendar.APRIL);
        } else if (quarter == 3) {
            calendar.set(Calendar.MONTH, Calendar.JULY);
        } else {
            calendar.set(Calendar.MONTH, Calendar.OCTOBER);
        }
        return dateReservedMonth000(calendar);
    }
639306
public static int getDayOfMonth(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        return c.get(Calendar.DAY_OF_MONTH);
    }
246765
public String format(Calendar calendar) {
    // As the relative period is calculated on epoch (timeInMillis), no TimeZone information is needed
    Calendar smscCalendar = Calendar.getInstance();
    return format(calendar, smscCalendar);
  }
1261414
public static Date getFirstDayOfMonth(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int firstDay = calendar.getActualMinimum(Calendar.DAY_OF_MONTH);
        return org.apache.commons.lang.time.DateUtils.setDays(date, firstDay);
    }
59152
public boolean isSameDate(CalendarDate date) {
        return getDayOfWeek() == date.getDayOfWeek()
            && getMonth() == date.getMonth()
            && getYear() == date.getYear()
            && getEra() == date.getEra();
    }
102759
public static Date dateReservedDay000(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return dateReservedDay000(calendar);
    }
1043433
public int getSeconds() {
		// TODO ahai 如果当月时间未到呢？
		Calendar cld = Calendar.getInstance();
		cld.add(Calendar.MONTH, 1);
		cld.set(Calendar.DAY_OF_MONTH, day);
		cld.set(Calendar.HOUR_OF_DAY, this.hour);
		cld.set(Calendar.MINUTE, this.minute);
		cld.set(Calendar.SECOND, this.second);
		long time = cld.getTimeInMillis();
		long diff = time - System.currentTimeMillis();
		if (diff <= 0) {// 一定要小于等于0
			// 本周的时间已过，下周再执行
			diff += 7 * 24 * 60 * 60 * 1000L;
		}
		int seconds = (int) (diff / 1000);
		return seconds;
	}
1000733
public static Calendar createCalendar(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        return cal;
    }
822624
public static Date dateReservedMonth000(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);

        return dateReservedMonth000(calendar);
    }
828505
public static Date dateReservedQuarter999(int year, int quarter) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, year);
        if (quarter <= 1) {
            calendar.set(Calendar.MONTH, Calendar.MARCH);
        } else if (quarter == 2) {
            calendar.set(Calendar.MONTH, Calendar.JUNE);
        } else if (quarter == 3) {
            calendar.set(Calendar.MONTH, Calendar.SEPTEMBER);
        } else {
            calendar.set(Calendar.MONTH, Calendar.DECEMBER);
        }
        return dateReservedMonth999(calendar);
    }
42443
public static Integer getWeekOfYear(Date date) {

        if (date == null)
            return null;

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);

        return calendar.get(Calendar.WEEK_OF_YEAR);
    }
1150052
public static Date dateReservedYear(int year, boolean is000) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, year);

        return is000 ? dateReservedYear000(calendar) : dateReservedYear999(calendar);
    }
446008
public static Range<Date> getDatePeriod(final Date date, final Period period) {

    Calendar calendar = buildCalendar(date);
    Range<Date> dateRange = null;
    Date startDate = calendar.getTime();
    Date endDate = calendar.getTime();
    if (period != Period.DAY) {
      for (; period.getValue(date) == period.getValue(calendar.getTime()); calendar
          .add(DAY_OF_MONTH, 1)) {
        endDate = calendar.getTime();
      }

      calendar.setTime(date);
      for (; period.getValue(date) == period.getValue(calendar.getTime()); calendar
          .add(DAY_OF_MONTH, -1)) {
        startDate = calendar.getTime();
      }
    }
    calendarCache.add(calendar);
    dateRange = Range.getInstance(startDate, endDate);
    return dateRange;
  }
41048
public static Date dateReservedYear999(Calendar calendar) {
        calendar.set(Calendar.MONTH, Calendar.DECEMBER);
        calendar.set(Calendar.DAY_OF_MONTH, 31);

        return dateReservedDay999(calendar);
    }
210482
public static String getFirstDayOfMonth(Date date){
        Calendar   ca   =   Calendar.getInstance();
        ca.setTime(date);
        ca.set(Calendar.DAY_OF_MONTH,   1);
        Date   firstDate   =   ca.getTime();
        return dateToString(firstDate);
    }
76192
private void getYearlyDates(Calendar calendar, List<Date> dates)
   {
      if (m_relative)
      {
         getYearlyRelativeDates(calendar, dates);
      }
      else
      {
         getYearlyAbsoluteDates(calendar, dates);
      }
   }