class MDateAndTime {

    public static int parseAndEncodeDate(String input) {
        long[] dt = new long[6];
        StringType type = parseDateOrTime(input, dt);
        switch(type) {
            case DATE_ST:
            case DATETIME_ST:
                return encodeDate(dt);
        }
        throw new InvalidDateFormatException("date", input);
    }

}