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

@param calendar 一个日期
@return 被转化后的日期
@see #dateReservedMonth999(Date)
481891
public static Date dateReservedMonth999(Calendar calendar) {
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.add(Calendar.MONTH, 1);
        calendar.add(Calendar.DAY_OF_MONTH, -1);
        return dateReservedDay999(calendar);
    }
45384
public static Calendar getDateCeil(Date date) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(date);
        return new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
    }
1351825
public byte[] serialize(Calendar date)
   {
      final String calendarString =
         CALENDAR_FIELDS_SEPARATOR + date.isLenient() + CALENDAR_FIELDS_DELIMITER + date.getFirstDayOfWeek()
            + CALENDAR_FIELDS_DELIMITER + date.getMinimalDaysInFirstWeek() + CALENDAR_FIELDS_DELIMITER
            + date.getTimeZone().getID();

      return (format(date) + calendarString).getBytes();
   }
253042
private static Date getDate(int day, int month, int year) {
		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.YEAR, year);
		cal.set(Calendar.MONTH, month);
		cal.set(Calendar.DATE, day);
		return cal.getTime();
	}
1240774
public static int getDayAsReadableInt(Calendar calendar) {
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        int month = calendar.get(Calendar.MONTH) + 1;
        int year = calendar.get(Calendar.YEAR);
        return year * 10000 + month * 100 + day;
    }
516701
public static Long getMonth1stDay() {
		cal.setTimeInMillis(System.currentTimeMillis());
		cal.set(Calendar.DATE, 1);
		return cal.getTimeInMillis();
	}
893499
public static Calendar calendar(Date date) {
		if(date instanceof DateTime) {
			return ((DateTime)date).toCalendar();
		}else {
			return calendar(date.getTime());
		}
	}
1149188
private static Calendar dateToCalendar(Date date) {
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		return cal;
	}
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);
    }
453141
public static Calendar parse(final String date, final DateTimeFormatter format) {
		return format.parseDateTime(date).toGregorianCalendar();
	}
679429
public static Integer getDayNumOfSeason(Date date) {

        if (date == null)
            return null;

        int day = 0;
        Date[] seasonDates = getSeasonDate(date);
        for (Date d : seasonDates) {
            day += getDayOfMonth(d);
        }
        return day;
    }
913927
public static Calendar toCalendar(final Date date) {
        final Calendar c = Calendar.getInstance();
        c.setTime(date);
        return c;
    }
542210
private static String getDaysInMonthBound(int year, int month) {
	    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
		cal.set(Calendar.YEAR, year);
	    cal.set(Calendar.MONTH, month);
		cal.set(Calendar.DAY_OF_MONTH, 1);
		return new Integer(cal.getActualMaximum(Calendar.DAY_OF_MONTH)).toString();
	}
1115663
public static Date dateReservedDay000(Calendar calendar) {
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar.getTime();
    }
217950
public String getMealDesc(Date date)
    {
        if (m_rgstrMeals == null)
            return Constants.BLANK;

        Date startDate = this.getStartDate();
        Converter.initGlobals();    // Make sure calendars are set up
        Calendar calendar = Converter.gCalendar;
        calendar.setTime(startDate);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        startDate = calendar.getTime();
        
        calendar.setTime(date);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        date = calendar.getTime();
        
        long lTimeToTarget = date.getTime() - startDate.getTime();
        int iTargetDay = (int)(lTimeToTarget / Constants.KMS_IN_A_DAY);   // Day 0 = first day
        if ((iTargetDay < 0) || (iTargetDay >= m_rgstrMeals.length))
            return Constants.BLANK;
        String strMeals = m_rgstrMeals[iTargetDay];
        if (strMeals == null)
            return Constants.BLANK;
        return strMeals;
    }
870351
public static int getLastDayOfMonth(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        return c.getActualMaximum(Calendar.DATE);
    }
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);
    }