给定时间，获取一年中的第几天。
@param date 时间({@link Date})
@return （Integer）,如果date is null，将返回null
11157
public static Integer getDayOfYear(Date date) {

        if (date == null)
            return null;

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

        return calendar.get(Calendar.DAY_OF_YEAR);
    }
264517
public static String formatDate(Date d) {
    return d == null ? null : DATE_FORMAT.format(d);
  }
635335
private static Calendar getCalendar(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return calendar;
    }
28353
public static String parseDateWithoutFraction(String date) {
        if(date == null) return "";
        if (date.length() < 20) {
            return date;
        }
        return date.substring(0, 19);
    }
1093646
public static DateValue getInstance(Date date) {
        DateValue result;
        if (date != null) {
            synchronized (cache) {
                result = cache.get(date);
                if (result == null) {
                    result = new DateValue(date);
                    cache.put(date, result);
                }
            }
        } else {
            result = getInstance(new Date());
        }
        return result;
    }
1144958
public String getMealDesc(Date date)
    {
        if (!date.before(m_startTime)) if (!date.after(m_endTime))
            return m_strMeals;
        return null;
    }
745127
public String quote (Date date)
    {
        return (date == null) ? null : escape(String.valueOf(date));
    }
598399
public static Date getLastDateOfSeason(Date date) {

        if (date == null)
            return null;

        return getLastDateOfMonth(getSeasonDate(date)[2]);
    }
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;
    }
106840
@CheckForNull
  public static Date parseDateOrDateTime(@Nullable String stringDate) {
    if (stringDate == null) {
      return null;
    }

    OffsetDateTime odt = parseOffsetDateTimeQuietly(stringDate);
    if (odt != null) {
      return Date.from(odt.toInstant());
    }

    LocalDate ld = parseLocalDateQuietly(stringDate);
    checkArgument(ld != null, "Date '%s' cannot be parsed as either a date or date+time", stringDate);

    return Date.from(ld.atStartOfDay(ZoneId.systemDefault()).toInstant());
  }
354694
public static Integer getDayNumOfMonth(Date date) {

        if (date == null)
            return null;

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

        return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
    }
1053361
public static Date toDate(LocalDate date)
	{
		if(date == null)
			return null;
		
		return  java.util.Date
	      .from(date.atStartOfDay(ZoneId.systemDefault())
	      .toInstant());
	}
834151
public static int getDaysOfMonth(Date date) {
		DateTime dt = new DateTime(date.getTime());
		return getDaysOfMonth(dt.getYear(), dt.getMonthOfYear());
	}
10092
public static Date addYear(Date date1, int addYear) {
        Date resultDate = null;
        Calendar c = Calendar.getInstance();
        c.setTime(date1); // 设置当前日期
        c.add(Calendar.YEAR, addYear); // 日期加1
        resultDate = c.getTime(); // 结果
        return resultDate;
    }
1280666
public static Date parseTimestamp(String date) {
		try {
			return hasText(date) ? timestampParser.parse(date) : null;
		} catch (ParseException e) {
			logger.log(Level.WARNING, "parseTimestamp - ParseException caught.", e);
		}

		return null;
	}
314214
private static Date parse(String date) {
        for (int i = 0; i < fmt.length; i++) {
            try {
                SimpleDateFormat df = new SimpleDateFormat(fmt[i]);
                return df.parse(date);
            } catch (ParseException E) {
                // keep trying
            }
        }
        throw new IllegalArgumentException(date);
    }
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();
	}