public static Date getSecondsSinceEpoch(String timestamp)
    throws ParseException {
        if (timestamp.length() < 14) {
            if (timestamp.length() < 10 && (timestamp.length() % 2) == 1) {
                throw new IllegalArgumentException("Must have year, " +
                    "month, date, hour or second granularity: " + timestamp);
            }
            if (timestamp.length() == 4) {
                // Add first month and first date.
                timestamp = timestamp + "01010000";
            }
            if (timestamp.length() == 6) {
                // Add a date of the first.
                timestamp = timestamp + "010000";
            }
            if (timestamp.length() < 14) {
                timestamp = timestamp +
                    padTo("", 14 - timestamp.length(), '0');
            }
        }
        return parse14DigitDate(timestamp);
    }
public static Date getSecondsSinceEpoch ( String timestamp ) throws ParseException { if ( timestamp . length ( ) < 14 ) { if ( timestamp . length ( ) < 10 && ( timestamp . length ( ) % 2 ) == 1 ) { throw new IllegalArgumentException ( "Must have year, " + "month, date, hour or second granularity: " + timestamp ) ; } if ( timestamp . length ( ) == 4 ) { timestamp = timestamp + "01010000" ; } if ( timestamp . length ( ) == 6 ) { timestamp = timestamp + "010000" ; } if ( timestamp . length ( ) < 14 ) { timestamp = timestamp + padTo ( "" , 14 - timestamp . length ( ) , '0' ) ; } } return parse14DigitDate ( timestamp ) ; }
@param timestamp A 14-digit timestamp or the suffix for a 14-digit
timestamp: E.g. '20010909014640' or '20010101' or '1970'.
@return A date.
@see #secondsSinceEpoch(String)
@throws ParseException