Parse a string into a java.util.Date object.  The
string must be in ISO 9601 format (yyyy-MM-dd).
@todo why not throw the exception in a different format?
why do we kill it here and return null?
503546
static private final Date parseISODate(String stringValue)
  {
    try
    {
      return getDateFormat().parse(stringValue);
    }
    catch (ParseException pe)
    {
      if (LOG.isLoggable(Level.INFO))
      {
        LOG.log(Level.INFO, "CANNOT_PARSE_VALUE_INTO_DATE_WITH_YYYY_MM_DD_PATTERN "+ stringValue, pe);
      }
      return null;
    }
  }
342603
public static DateTime iso8601DateTimeFromString(String dateTimeString) {
        try {
            return DateTime.parse(dateTimeString, ISO8601_DATE_TIME_FORMATTER);
        } catch (Exception e) {
            return null;
        }
    }
710646
public static Date toDate(String dateTimeString) throws ParseException {
        Instant instant = toInstant(dateTimeString);
        return (instant != null ? Date.from(instant) : null);
    }
131659
def parse_date(date, default=None):
    
    if date == "":
        if default is not None:
            return default
        else:
            raise Exception("Unknown format for " + date)

    for format_type in ["%Y-%m-%d %H:%M:%S", "%Y-%m-%d %H:%M", "%Y-%m-%d %H", "%Y-%m-%d", "%d/%m/%Y %H:%M:%S", "%d/%m/%Y %H:%M", "%d/%m/%Y %H",
                        "%d/%m/%Y"]:
        try:
            return datetime.strptime(date, format_type)
        except ValueError:
            pass
    raise Exception("Unknown format for " + date)
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);
    }
369084
@Override
    protected Time parseString(final DateFormat formatter, final String text) throws ParseException {
        Date date = formatter.parse(text);
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.set(1899, 12-1, 31);

        return convertTypeValue(cal.getTime());
    }
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);
    }
  }
1344205
private static Date parse(String dateStr, DateFormat dateFormat) {
		try {
			return dateFormat.parse(dateStr);
		} catch (Exception e) {
			String pattern;
			if (dateFormat instanceof SimpleDateFormat) {
				pattern = ((SimpleDateFormat) dateFormat).toPattern();
			} else {
				pattern = dateFormat.toString();
			}
			throw new DateException(StrUtil.format("Parse [{}] with format [{}] error!", dateStr, pattern), e);
		}
	}
1340455
def string_to_date(value):
    
    if isinstance(value, datetime.date):
        return value

    return dateutil.parser.parse(value).date()
1252966
def _parse_date(string: str) -> datetime.date:
    
    return datetime.datetime.strptime(string, '%Y-%m-%d').date()
255837
def parse_date(self, value):
        
        if value is None:
            raise Exception("Unable to parse date from %r" % value)
        elif isinstance(value, string_types):
            return self.str2date(value)
        elif isinstance(value, int):
            return date.fromordinal(value)
        elif isinstance(value, datetime):
            return value.date()
        elif isinstance(value, date):
            return value
        else:
            raise Exception("Unable to parse date from %r" % value)
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;
    }
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;
        }
    }
953082
def deserialize_date(string):
    
    try:
        from dateutil.parser import parse
        return parse(string).date()
    except ImportError:
        return string
211733
public Date toDate(String dateString) {
        Date date = null;
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        try {
            date = df.parse(dateString);
        } catch (ParseException ex) {
            System.out.println(ex.fillInStackTrace());
        }
        return date;
    }
446737
public static Date toDateFromIso8601(String s) {
        if (s == null) return null;
        return ISODateTimeFormat.dateTimeNoMillis().parseDateTime(s).toDate();
    }
746255
public static Calendar parse(String dateString) throws ValueFormatException
   {
      try
      {
         return ISO8601.parseEx(dateString);
      }
      catch (ParseException e)
      {
         throw new ValueFormatException("Can not parse date from [" + dateString + "]", e);
      }
      catch (NumberFormatException e)
      {
         throw new ValueFormatException("Can not parse date from [" + dateString + "]", e);
      }
   }