cdm/src/main/java/ucar/nc2/units/DateFromString.java
public static Date getDateUsingSimpleDateFormat( String dateString, String dateFormatString )
  {
    // Determine first numeric character in dateString and drop proceeding characters.
    int smallestIndex = dateString.length();
    if ( smallestIndex == 0 ) return null;
    for ( int i = 0; i < 10; i++ )
    {
      int curIndex = dateString.indexOf( String.valueOf( i ) );
      if ( curIndex != -1 && smallestIndex > curIndex )
        smallestIndex = curIndex;
    }

    return getDateUsingCompleteDateFormatWithOffset( dateString, dateFormatString, smallestIndex );
  }
public static Date getDateUsingSimpleDateFormat( String dateString, String dateFormatString )
  {
    // Determine first numeric character in dateString and drop proceeding characters.
    int smallestIndex = dateString.length();
    if ( smallestIndex == 0 ) return null;
    for ( int i = 0; i < 10; i++ )
    {
      int curIndex = dateString.indexOf( String.valueOf( i ) );
      if ( curIndex != -1 && smallestIndex > curIndex )
        smallestIndex = curIndex;
    }

    return getDateUsingCompleteDateFormatWithOffset( dateString, dateFormatString, smallestIndex );
  }
public static Date getDateUsingSimpleDateFormat ( String dateString , String dateFormatString ) { // Determine first numeric character in dateString and drop proceeding characters. int smallestIndex = dateString . length ( ) ; if ( smallestIndex == 0 ) return null ; for ( int i = 0 ; i < 10 ; i ++ ) { int curIndex = dateString . indexOf ( String . valueOf ( i ) ) ; if ( curIndex != - 1 && smallestIndex > curIndex ) smallestIndex = curIndex ; } return getDateUsingCompleteDateFormatWithOffset ( dateString , dateFormatString , smallestIndex ) ; }
Parse the given date string (starting at the first numeric character)
using the given date format string (as described in
java.text.SimpleDateFormat) and return a Date.

@param dateString the String to be parsed
@param dateFormatString the date format String
@return the Date that was parsed.
Parse the given date string ( starting at the first numeric character ) using the given date format string ( as described in java . text . SimpleDateFormat ) and return a Date .