/** * This method accepts three types of months given: - Single and Double Digit months from 1 to 12 * (01 to 12) - 3 Digit BibTex strings (jan, feb, mar...) - Full English Month identifiers. * * @param value the given value * @return the corresponding Month instance */ public static Month getMonth(String value) { if (value == null) { return MonthUtil.NULL_OBJECT; } // Much more liberal matching covering most known abbreviations etc. String testString = value.replace("#", "").trim(); if (testString.length() > 3) { testString = testString.substring(0, 3); } Month m = MonthUtil.getMonthByShortName(testString); if (m.isValid()) { return m; } try { int number = Util.intValueOf(value); return MonthUtil.getMonthByNumber(number); } catch (NumberFormatException e) { return MonthUtil.NULL_OBJECT; } }