src/main/java/org/jivesoftware/smack/util/StringUtils.java
private static Date handleDateWithMissingLeadingZeros(String stampString,
            int dateLength) throws ParseException {
        if (dateLength == 6) {
            synchronized (xep0091Date6DigitFormatter) {
                return xep0091Date6DigitFormatter.parse(stampString);
            }
        }
        Calendar now = Calendar.getInstance();

        Calendar oneDigitMonth = parseXEP91Date(stampString,
                xep0091Date7Digit1MonthFormatter);
        Calendar twoDigitMonth = parseXEP91Date(stampString,
                xep0091Date7Digit2MonthFormatter);

        List<Calendar> dates = filterDatesBefore(now, oneDigitMonth,
                twoDigitMonth);

        if (!dates.isEmpty()) {
            return determineNearestDate(now, dates).getTime();
        }
        return null;
    }
private static Date handleDateWithMissingLeadingZeros(String stampString,
            int dateLength) throws ParseException {
        if (dateLength == 6) {
            synchronized (xep0091Date6DigitFormatter) {
                return xep0091Date6DigitFormatter.parse(stampString);
            }
        }
        Calendar now = Calendar.getInstance();

        Calendar oneDigitMonth = parseXEP91Date(stampString,
                xep0091Date7Digit1MonthFormatter);
        Calendar twoDigitMonth = parseXEP91Date(stampString,
                xep0091Date7Digit2MonthFormatter);

        List<Calendar> dates = filterDatesBefore(now, oneDigitMonth,
                twoDigitMonth);

        if (!dates.isEmpty()) {
            return determineNearestDate(now, dates).getTime();
        }
        return null;
    }
private static Date handleDateWithMissingLeadingZeros ( String stampString , int dateLength ) throws ParseException { if ( dateLength == 6 ) { synchronized ( xep0091Date6DigitFormatter ) { return xep0091Date6DigitFormatter . parse ( stampString ) ; } } Calendar now = Calendar . getInstance ( ) ; Calendar oneDigitMonth = parseXEP91Date ( stampString , xep0091Date7Digit1MonthFormatter ) ; Calendar twoDigitMonth = parseXEP91Date ( stampString , xep0091Date7Digit2MonthFormatter ) ; List < Calendar > dates = filterDatesBefore ( now , oneDigitMonth , twoDigitMonth ) ; if ( ! dates . isEmpty ( ) ) { return determineNearestDate ( now , dates ) . getTime ( ) ; } return null ; }
Parses the given date string in different ways and returns the date that
lies in the past and/or is nearest to the current date-time.

@param stampString
date in string representation
@param dateLength
@param noFuture
@return the parsed date
@throws ParseException
The date string was of an unknown format
Parses the given date string in different ways and returns the date that lies in the past and / or is nearest to the current date - time .