Parse a data string into a real Date
<p/>
Note: (e.g. "yyyy-MM-dd HH:mm:ss")

@param dateString date in String format
@param dateFormat desired format (e.g. "yyyy-MM-dd HH:mm:ss")
@return
166489
public static java.util.Date parseDate(String dateString, String dateFormat) {
        java.util.Date newDate = null;

        try {
            newDate = new SimpleDateFormat(dateFormat, Locale.ENGLISH)
                    .parse(dateString);
        } catch (ParseException e) {
            QuickUtils.log.d("parse error", e);
        }
        return newDate;
    }
544819
public void setDateFormatString(String dateFormatString) {
		if (ignoreDatePatternChange) {
			return;
		}

		try {
			dateFormatter.applyPattern(dateFormatString);
		} catch (RuntimeException e) {
			dateFormatter = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.MEDIUM);
			dateFormatter.setLenient(false);
		}
		this.datePattern = dateFormatter.toPattern();
		setToolTipText(this.datePattern);
		setDate(date, false);
	}
979129
public static DateTime parseTimeToday(String timeString) {
		timeString = StrUtil.format("{} {}", today(), timeString);
		return parse(timeString, DatePattern.NORM_DATETIME_FORMAT);
	}
898590
private Date getDate(final String isoFormat) {
		try {
			final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
			return dateFormat.parse(isoFormat);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
1028893
public static Date parseISO8601Date(String dateString) {
        try {
            return doParseISO8601Date(dateString);
        } catch(RuntimeException ex) {
            throw handleException(ex);
        }
    }
1036035
protected T parseString(final DateFormat formatter, final String text) throws ParseException {
        Date date = formatter.parse(text);
        return convertTypeValue(date);
    }
1242748
public static Date parseDate(String dateStr) {
        SimpleDateFormat format = null;
        if (StringUtils.isBlank(dateStr))
            return null;
        String _dateStr = dateStr.trim();
        try {
            if (_dateStr.matches("\\d{1,2}[A-Z]{3}")) {
                _dateStr = _dateStr
                        + (Calendar.getInstance().get(Calendar.YEAR) - 2000);
            }
            // 01OCT12
            if (_dateStr.matches("\\d{1,2}[A-Z]{3}\\d{2}")) {
                format = new SimpleDateFormat("ddMMMyy", Locale.ENGLISH);
            } else if (_dateStr.matches("\\d{1,2}[A-Z]{3}\\d{4}.*")) {// 01OCT2012
                // ,01OCT2012
                // 1224,01OCT2012
                // 12:24
                _dateStr = _dateStr.replaceAll("[^0-9A-Z]", "")
                        .concat("000000").substring(0, 15);
                format = new SimpleDateFormat("ddMMMyyyyHHmmss", Locale.ENGLISH);
            } else {
                StringBuffer sb = new StringBuffer(_dateStr);
                String[] tempArr = _dateStr.split("\\s+");
                tempArr = tempArr[0].split("-|\\/");
                if (tempArr.length == 3) {
                    if (tempArr[1].length() == 1) {
                        sb.insert(5, "0");
                    }
                    if (tempArr[2].length() == 1) {
                        sb.insert(8, "0");
                    }
                }
                _dateStr = sb.append("000000").toString().replaceAll("[^0-9]",
                        "").substring(0, 14);
                if (_dateStr.matches("\\d{14}")) {
                    format = new SimpleDateFormat("yyyyMMddHHmmss");
                }
            }
            Date date = format.parse(_dateStr);
            return date;
        } catch (Exception e) {
            throw new RuntimeException("无法解析日期字符[" + dateStr + "]");
        }
    }
1126643
public static String getStringFromDateTime(Date date) throws ParseException {
        SimpleDateFormat formatter = new SimpleDateFormat(DATE_yyyyMMddTHHmmssSSSZone);
        return formatter.format(date);
    }
443762
public static String stringToString(String dateString, String desfmt) {
        // ISO_DATE_FORMAT = "yyyyMMdd";
        if (dateString.trim().length() == 8) {
            return stringToString(dateString, ISO_DATE_FORMAT, desfmt);
        } else if (dateString.trim().length() == 10) {
            // ISO_EXPANDED_DATE_FORMAT = "yyyy-MM-dd";
            return stringToString(dateString, ISO_EXPANDED_DATE_FORMAT, desfmt);
        } else if (dateString.trim().length() == 19) {
            // DATETIME_PATTERN = "yyyy-MM-dd hh:mm:ss";
            return stringToString(dateString.substring(0, 10),
                    ISO_EXPANDED_DATE_FORMAT, desfmt);
        } else if (dateString.trim().length() == 11) {
            // CHINESE_EXPANDED_DATE_FORMAT = "yyyy年MM月dd日";
            return stringToString(dateString, CHINESE_EXPANDED_DATE_FORMAT,
                    desfmt);
        }
        return null;
    }
1231150
public static MonthDay parse(String str, DateTimeFormatter formatter) {
        LocalDate date = formatter.parseLocalDate(str);
        return new MonthDay(date.getMonthOfYear(), date.getDayOfMonth());
    }
1305087
public static Date stringToDate(String source, String format) throws ParseException {

        if (StringUtils.isEmpty(source))
            return null;

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
        return simpleDateFormat.parse(source);
    }
474694
public static Date dateStringToDate(String dateString){
		SimpleDateFormat sdf=new SimpleDateFormat(DateTimeKit.FULL_DATE_24HR_STYLE);
		Date date = null;
		try {
			date = sdf.parse(dateString);
		} catch (ParseException e) {}  
		return date;
	}
206354
public static function fromFormat(string $format, string $dateString) : Date
    {
        return self::fromNative(\DateTimeImmutable::createFromFormat($format, $dateString));
    }
158920
public Date parseDate(String str) {
        if (str == null)
            return null;
        try {
            return dateFormat.parse(str);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
533852
public void setDate(String dateString)
    {
		Date date = null;
		try	{
            if ((dateString != null) && (dateString.length() > 0))
                date = dateFormat.parse(dateString);
		} catch (Exception e)	{
            date = null;
		}
        this.setDate(date);
    }
1068305
public static String getCalendarJavaDateFormat(String dateFormat) {

        dateFormat = CmsStringUtil.substitute(dateFormat, "%", ""); // remove all "%"
        dateFormat = CmsStringUtil.substitute(dateFormat, "m", "${month}");
        dateFormat = CmsStringUtil.substitute(dateFormat, "H", "${hour}");
        dateFormat = CmsStringUtil.substitute(dateFormat, "Y", "${4anno}");
        dateFormat = dateFormat.toLowerCase();
        dateFormat = CmsStringUtil.substitute(dateFormat, "${month}", "M");
        dateFormat = CmsStringUtil.substitute(dateFormat, "${hour}", "H");
        dateFormat = CmsStringUtil.substitute(dateFormat, "y", "yy");
        dateFormat = CmsStringUtil.substitute(dateFormat, "${4anno}", "yyyy");
        dateFormat = CmsStringUtil.substitute(dateFormat, "m", "mm"); // minutes with two digits
        dateFormat = dateFormat.replace('e', 'd'); // day of month
        dateFormat = dateFormat.replace('i', 'h'); // 12 hour format
        dateFormat = dateFormat.replace('p', 'a'); // pm/am String
        return dateFormat;
    }
682120
public static Date parseRFC822Date(String dateString) {
        if (dateString == null) {
            return null;
        }
        try {
            return new Date(rfc822DateFormat.parseMillis(dateString));
        } catch(RuntimeException ex) {
            throw handleException(ex);
        }
    }