将date Str 转换为 Date 类型
<p>Function: parseDate</p>
<p>Description: </p>

@param timeType
@param date
@return
@author acexy@thankjava.com
@date 2015年6月18日 上午9:59:42
@version 1.0
322212
public static Date parseDate(TimeType timeType, String date) {
        SimpleDateFormat sdf = getDateFormat(timeType);
        try {
            return sdf.parse(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
775550
public JKTimeObject toTimeObject(Date date, Date time) {
		JKTimeObject fsTimeObject = new JKTimeObject();
		Calendar timeInstance = Calendar.getInstance();
		timeInstance.setTimeInMillis(time.getTime());
		fsTimeObject.setHour(timeInstance.get(Calendar.HOUR_OF_DAY));
		fsTimeObject.setMunite(timeInstance.get(Calendar.MINUTE));

		Calendar dateInstance = Calendar.getInstance();
		dateInstance.setTime(date);
		fsTimeObject.setYear(dateInstance.get(Calendar.YEAR));
		fsTimeObject.setMonth(dateInstance.get(Calendar.MONTH));
		fsTimeObject.setDay(dateInstance.get(Calendar.DAY_OF_MONTH));
		return fsTimeObject;
	}
93327
def _get_date_type(date):
        
        if isinstance(date, str):
            return 'str'

        if isinstance(date, datetime.date):
            return 'date'

        if isinstance(date, int):
            return 'int'

        raise ValueError('Unexpected type {0!s}'.format(date.__class__))
1098965
@Deprecated
	public static boolean isValidDate(String date) {
		try {
			convertStringDateToTime(date);
			return true;
		} catch (IllegalArgumentException err) {
			return false;
		}
	}
1077114
public static Date parseDate(String date, String pattern) {
        try {
            return org.apache.commons.lang.time.DateUtils.parseDate(date, new String[] {pattern});
        } catch (ParseException e) {
            return null;
        }
    }
681017
public static Calendar parseDividendDate(String date) {
        if (!Utils.isParseable(date)) {
            return null;
        }
        date = date.trim();
        SimpleDateFormat format = new SimpleDateFormat(Utils.getDividendDateFormat(date), Locale.US);
        format.setTimeZone(TimeZone.getTimeZone(YahooFinance.TIMEZONE));
        try {
            Calendar today = Calendar.getInstance(TimeZone.getTimeZone(YahooFinance.TIMEZONE));
            Calendar parsedDate = Calendar.getInstance(TimeZone.getTimeZone(YahooFinance.TIMEZONE));
            parsedDate.setTime(format.parse(date));

            if (parsedDate.get(Calendar.YEAR) == 1970) {
                // Not really clear which year the dividend date is... making a reasonable guess.
                int monthDiff = parsedDate.get(Calendar.MONTH) - today.get(Calendar.MONTH);
                int year = today.get(Calendar.YEAR);
                if (monthDiff > 6) {
                    year -= 1;
                } else if (monthDiff < -6) {
                    year += 1;
                }
                parsedDate.set(Calendar.YEAR, year);
            }

            return parsedDate;
        } catch (ParseException ex) {
            log.warn("Failed to parse dividend date: " + date);
            log.debug("Failed to parse dividend date: " + date, ex);
            return null;
        }
    }
1260851
@Pure
	public static Date parseDate(String xmlDate) throws DateFormatException {
		if (xmlDate == null || xmlDate.isEmpty()) {
			return null;
		}
		final SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT);
		try {
			return format.parse(xmlDate);
		} catch (Exception e) {
			//
		}
		throw new DateFormatException(xmlDate);
	}
1274678
private static String formatDate(Date date) {
        SimpleDateFormat formatter = new SimpleDateFormat(
                "yyyy-MM-dd'T'HH:mm:ss'Z'");
        formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
        return formatter.format(date);
    }
946616
public static Timestamp of(Date date) {
    return ofTimeMicroseconds(TimeUnit.MILLISECONDS.toMicros(date.getTime()));
  }
942647
static final java.util.Date parseDate(String formatted) {
        if (formatted == null || formatted.trim().equals(""))
            return null;

        try {
            DatatypeFactory factory = DatatypeFactory.newInstance();
            XMLGregorianCalendar calendar = factory.newXMLGregorianCalendar(formatted);
            return calendar.toGregorianCalendar().getTime();
        }
        catch (Exception e) {
            Matcher matcher = PATTERN_DD_MM_YYYY.matcher(formatted);

            // Try matching dd.MM.yyyy date formats first
            if (matcher.find()) {
                String yyyy = matcher.group(3);
                String mm = matcher.group(2);
                String dd = matcher.group(1);
                String hh = defaultIfEmpty(matcher.group(4), "0");
                String min = defaultIfEmpty(matcher.group(5), "0");
                String ss = defaultIfEmpty(matcher.group(6), "0");
                String ms = defaultIfEmpty(matcher.group(7), "0");

                return getDate(Integer.parseInt(yyyy),
                               Integer.parseInt(mm),
                               Integer.parseInt(dd),
                               Integer.parseInt(hh),
                               Integer.parseInt(min),
                               Integer.parseInt(ss),
                               Integer.parseInt(ms));
            }

            // Then try matching yyyy-MM-dd date formats
            else {
                Matcher matcher2 = PATTERN_YYYY_MM_DD.matcher(formatted);

                if (matcher2.find()) {
                    String yyyy = matcher2.group(1);
                    String mm = defaultIfEmpty(matcher2.group(2), "1");
                    String dd = defaultIfEmpty(matcher2.group(3), "1");
                    String hh = defaultIfEmpty(matcher2.group(4), "0");
                    String min = defaultIfEmpty(matcher2.group(5), "0");
                    String ss = defaultIfEmpty(matcher2.group(6), "0");
                    String ms = defaultIfEmpty(matcher2.group(7), "0");

                    return getDate(Integer.parseInt(yyyy),
                                   Integer.parseInt(mm),
                                   Integer.parseInt(dd),
                                   Integer.parseInt(hh),
                                   Integer.parseInt(min),
                                   Integer.parseInt(ss),
                                   Integer.parseInt(ms));
                }

                // Finally, try matching plain timestamps
                else {
                    try {
                        return new Date(Long.parseLong(formatted));
                    } catch (NumberFormatException ignore) {
                        return null;
                    }
                }
            }
        }
    }
390863
public static synchronized String getTime(Date date) {
		if (date == null) {
			return null;
		}
		return GET_TIME_FORMAT.format(date);
	}
479734
public static Date strToDate(String date) throws ParseException {

        java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMdd");

        java.util.Date d = sdf.parse(date);

        return d;
    }
983636
public static String formatDateTime (Date date)
    {
        return (date == null) ? "" : _msgs.dateTime(formatDate(date), formatTime(date));
    }
412725
function (date, type) {
            var time = date.getTime(),
                d = datepicker.getParsedDate(date),
                min = datepicker.getParsedDate(this.minDate),
                max = datepicker.getParsedDate(this.maxDate),
                dMinTime = new Date(d.year, d.month, min.date).getTime(),
                dMaxTime = new Date(d.year, d.month, max.date).getTime(),
                types = {
                    day: time >= this.minTime && time <= this.maxTime,
                    month: dMinTime >= this.minTime && dMaxTime <= this.maxTime,
                    year: d.year >= min.year && d.year <= max.year
                };
            return type ? types[type] : types.day
        }
1310398
function (timeString, withDate) {
			if (!this.inst) {
				this.inst = $.datepicker._getInst(this.$input[0]);
			}

			if (withDate || !this._defaults.timeOnly) {
				var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
				try {
					var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
					if (!parseRes.timeObj) {
						return false;
					}
					$.extend(this, parseRes.timeObj);
				} catch (err) {
					$.timepicker.log("Error parsing the date/time string: " + err +
									"\ndate/time string = " + timeString +
									"\ntimeFormat = " + this._defaults.timeFormat +
									"\ndateFormat = " + dp_dateFormat);
					return false;
				}
				return true;
			} else {
				var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
				if (!timeObj) {
					return false;
				}
				$.extend(this, timeObj);
				return true;
			}
		}
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());
  }
1207162
public static String formatTime(Date date) {
		if (null == date) {
			return null;
		}
		return DatePattern.NORM_TIME_FORMAT.format(date);
	}