Parse the given date using the {@link #OCCURRENCE_DATE_FORMAT} format.

@param pDate
a string representation of a date
@return the date
@throws ParseException
date malformed
546292
public static Date parseDate(final String pDate) throws ParseException {

        final SimpleDateFormat format = new SimpleDateFormat(OCCURRENCE_DATE_FORMAT);
        return format.parse(pDate);
    }
223999
public void setExpirationDateString(String date) throws ParseException {
        if (StringUtils.isBlank(date)) {
            expirationDate = null;
            return;
        }

        expirationDate = dateFormat.parse(date);
    }
332668
private static Date parse(final String dateString) {
		try {
			return new SimpleDateFormat("dd/mm/yyyy").parse(dateString);
		} catch (ParseException e) {
			LOG.error("Error parsing date: " + dateString, e);
			return null;
		}
	}
453141
public static Calendar parse(final String date, final DateTimeFormatter format) {
		return format.parseDateTime(date).toGregorianCalendar();
	}
616034
func ParseDate(str string) (Time, error) {
	// date has no fractional seconds precision
	return ParseTime(str, mysql.TypeDate, MinFsp)
}
817941
public static Date strToDateWithFormat(String strDate, Format format) {
        SimpleDateFormat localFormat = (SimpleDateFormat) format;
        ParsePosition pos = new ParsePosition(0);
        Date strtodate = localFormat.parse(strDate, pos);
        return strtodate;
    }
145660
public static Calendar parseXmlDate(String xsDate) throws ParseException {
        try {
            DatatypeFactory df = DatatypeFactory.newInstance();
            XMLGregorianCalendar dateTime = df.newXMLGregorianCalendar(xsDate);
            return dateTime.toGregorianCalendar();
        } catch (DatatypeConfigurationException ex) {
            throw new ParseException("Unable to parse " + xsDate, ex);
        }
    }
25970
func ParseDate(dateStr string) *Date {
	dt := &Date{}

	dateStr = strings.TrimSpace(dateStr)
	dtRegex := regexp.MustCompile("([0-9]{4})(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):([0-5][0-9])(:([0-5][0-9])(\\.([0-9]+))?)?((Z)|(\\+|-)((0[0-9]|1[0-3]):([0-5][0-9])|(14):(00)))?)?)?)?")
	if m := dtRegex.FindStringSubmatch(dateStr); m != nil {
		y, mo, d, h, mi, s, ms, tzZu, tzOp, tzh, tzm := m[1], m[3], m[5], m[7], m[8], m[10], m[12], m[14], m[15], m[17], m[18]

		switch {
		case ms != "":
			dt.Precision = Millisecond

			// Fix milliseconds (.9 -> .900, .99 -> .990, .999999 -> .999 )
			switch len(ms) {
			case 1:
				ms += "00"
			case 2:
				ms += "0"
			case 3:
				// do nothing
			default:
				ms = ms[:3]
			}
		case s != "":
			dt.Precision = Second
		case mi != "":
			dt.Precision = Minute
		// NOTE: Skip hour precision since FHIR specification disallows it
		case d != "":
			dt.Precision = Day
		case mo != "":
			dt.Precision = Month
		case y != "":
			dt.Precision = Year
		default:
			dt.Precision = Millisecond
		}

		// Get the location (if no time components or no location, use local)
		loc := time.Local
		if h != "" {
			if tzZu == "Z" {
				loc, _ = time.LoadLocation("UTC")
			} else if tzOp != "" && tzh != "" && tzm != "" {
				tzhi, _ := strconv.Atoi(tzh)
				tzmi, _ := strconv.Atoi(tzm)
				offset := tzhi*60*60 + tzmi*60
				if tzOp == "-" {
					offset *= -1
				}
				loc = time.FixedZone(tzOp+tzh+tzm, offset)
			}
		}

		// Convert to a time.Time
		yInt, _ := strconv.Atoi(y)
		moInt, err := strconv.Atoi(mo)
		if err != nil {
			moInt = 1
		}
		dInt, err := strconv.Atoi(d)
		if err != nil {
			dInt = 1
		}
		hInt, _ := strconv.Atoi(h)
		miInt, _ := strconv.Atoi(mi)
		sInt, _ := strconv.Atoi(s)
		msInt, _ := strconv.Atoi(ms)

		dt.Value = time.Date(yInt, time.Month(moInt), dInt, hInt, miInt, sInt, msInt*1000*1000, loc)
	} else {
		// TODO: What should we do if the time format is wrong?  Right now, we default to NOW
		dt.Precision = Millisecond
		dt.Value = time.Now()
	}

	return dt
}
18859
private static Date toDateWithFormatString(String date, String format) {
    if (date == null) {
      return null;
    }

    try {
      return strategy.formatFor(format).parse(date);
    } catch (ParseException e) {
      UTILS_LOGGER.trace("Unable to parse date '{}' using format string '{}': {}", date, format, e);

      return null;
    }
  }
559960
public static Date parseDate(String date) {
        if (date == null) {
            return null;
        }
        try {
            return org.apache.commons.lang.time.DateUtils.parseDate(date, new String[] {DSP_DEFAULT_TIME_FORMAT});
        } catch (ParseException e) {
            return null;
        }
    }
345633
public static Date parseDate(final String dateValue, final String[] dateFormats) {
        return parseDate(dateValue, dateFormats, null);
    }
179055
@Override
  public final String toDateTimeSecMsString(final Date pDate,
    final Map<String, Object> pAddParam) throws Exception {
    return this.dateTimeSecMsFormat.format(pDate);
  }
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);
	}
909061
public static String toISO8601(Date pDate,TimeZone pTimeZone) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
        dateFormat.setTimeZone(pTimeZone);
        String ret = dateFormat.format(pDate);
        ret = ret.replaceAll("\\+0000$", "Z");
        return ret.replaceAll("(\\d\\d)$", ":$1");
    }
678259
public static Date toDate(final String pString, final DateFormat pFormat) {
        try {
            synchronized (pFormat) {
                // Parse date using given format
                return pFormat.parse(pString);
            }
        }
        catch (ParseException pe) {
            // Wrap in RuntimeException
            throw new IllegalArgumentException(pe.getMessage());
        }
    }
585089
public static Date fromISO8601DateString(String iso8601FormattedDate)
      throws com.fasterxml.jackson.databind.exc.InvalidFormatException {

    SimpleDateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    // set UTC time zone
    iso8601Format.setTimeZone(TimeZone.getTimeZone("UTC"));
    try {
      return iso8601Format.parse(iso8601FormattedDate);
    } catch (ParseException e) {
      throw new InvalidFormatException("Error parsing as date", iso8601FormattedDate, Date.class);
    }
  }
463500
public static Date fromISO8601(String pDateString) {
        if (datatypeFactory != null) {
            return datatypeFactory.newXMLGregorianCalendar(pDateString.trim()).toGregorianCalendar().getTime();
        } else {
            try {
                // Try on our own, works for most cases
                String date = pDateString.replaceFirst("([+-])(0\\d)\\:(\\d{2})$", "$1$2$3");
                date = date.replaceFirst("Z$","+0000");
                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
                return dateFormat.parse(date);
            } catch (ParseException e) {
                throw new IllegalArgumentException("Cannot parse date '" + pDateString + "': " +e,e);
            }
        }
    }