src/main/java/com/teamunify/i18n/I.java
public static Date stringToDate(String source) {
    Date rv = getDefaultDate();
    if (source == null || source.isEmpty())
      return rv;
    ParseException e = null;
    LanguageSetting s = languageProvider.vend();
    DateFormat formats[] = dateFormatVendor.getInputFormats(s.locale);
    for (DateFormat fmt : formats) {
      try {
        rv = fmt.parse(source);
        return rv;
      } catch (ParseException e1) {
        e = e1;
      }
    }

    // See if the user just forgot to tack on the year
    Calendar c = Calendar.getInstance();
    String year = String.format("%04d", c.get(Calendar.YEAR));
    if (!source.endsWith(year)) {
      if (source.contains("/"))
        return stringToDate(source + "/" + year);
      else if (source.contains("."))
        return stringToDate(source + "." + year);
    }

    if (log.isDebugEnabled())
      log.debug("Failed to parse date >{}< when using language settings for {}",
                source, s.locale.getLanguage(), e);

    return rv;
  }
/**
   * Attempts to parse the given date using the current language's locale, accepting any non-ambiguous date string
   * imaginable in that locale. This function accepts any legal date format for the given locale...
   * <p/>
   * <p/>
   * For example, in the US locale, this function will correctly accept ANY of 1/1/93, 01/01/93, 1/1/1993, 1993-01-01,
   * Jan 1, 1993, January 1, 2011.
   * <p/>
   * <p/>
   * ALL locales always accept the ISO standard YYYY-MM-DD as a fallback, which is useful when interacting with SQL.
   *
   * @param source The source date string. Can be a locale-specific string. Always accepts YYYY-MM-DD as a fallback.
   * @return The date. If parsing fails, the date will be whatever you have your defaultDate set to
   */
Attempts to parse the given date using the current language's locale, accepting any non-ambiguous date string
imaginable in that locale.

@param source The source date string. Can be a locale-specific string. Always accepts YYYY-MM-DD as a fallback.
@return The date. If parsing fails, the date will be whatever you have your defaultDate set to
Attempts to parse the given date using the current language ' s locale accepting any non - ambiguous date string imaginable in that locale . @param source The source date string . Can be a locale - specific string . Always accepts YYYY - MM - DD as a fallback . @return The date . If parsing fails the date will be whatever you have your defaultDate set to
public static Date stringToDate(String source) {
    Date rv = getDefaultDate();
    if (source == null || source.isEmpty())
      return rv;
    ParseException e = null;
    LanguageSetting s = languageProvider.vend();
    DateFormat formats[] = dateFormatVendor.getInputFormats(s.locale);
    for (DateFormat fmt : formats) {
      try {
        rv = fmt.parse(source);
        return rv;
      } catch (ParseException e1) {
        e = e1;
      }
    }
    Calendar c = Calendar.getInstance();
    String year = String.format("%04d", c.get(Calendar.YEAR));
    if (!source.endsWith(year)) {
      if (source.contains("/"))
        return stringToDate(source + "/" + year);
      else if (source.contains("."))
        return stringToDate(source + "." + year);
    }
    if (log.isDebugEnabled())
      log.debug("Failed to parse date >{}< when using language settings for {}",
                source, s.locale.getLanguage(), e);
    return rv;
  }
public static Date stringToDate ( String source ) { Date rv = getDefaultDate ( ) ; if ( source == null || source . isEmpty ( ) ) return rv ; ParseException e = null ; LanguageSetting s = languageProvider . vend ( ) ; DateFormat formats [ ] = dateFormatVendor . getInputFormats ( s . locale ) ; for ( DateFormat fmt : formats ) { try { rv = fmt . parse ( source ) ; return rv ; } catch ( ParseException e1 ) { e = e1 ; } } Calendar c = Calendar . getInstance ( ) ; String year = String . format ( "%04d" , c . get ( Calendar . YEAR ) ) ; if ( ! source . endsWith ( year ) ) { if ( source . contains ( "/" ) ) return stringToDate ( source + "/" + year ) ; else if ( source . contains ( "." ) ) return stringToDate ( source + "." + year ) ; } if ( log . isDebugEnabled ( ) ) log . debug ( "Failed to parse date >{}< when using language settings for {}" , source , s . locale . getLanguage ( ) , e ) ; return rv ; }
Attempts to parse the given date using the current language's locale, accepting any non-ambiguous date string
 imaginable in that locale.
Attempts to parse the given date using the current language ' s locale accepting any non - ambiguous date string imaginable in that locale .
// See if the user just forgot to tack on the year