List of utility methods to do Month Name Get
String | getMonthStr(String str) get Month Str String[] monthOfYear = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" }; if ("01".equals(str)) { str = monthOfYear[0]; } else if ("02".equals(str)) { str = monthOfYear[1]; } else if ("03".equals(str)) { str = monthOfYear[2]; ... |
String | getMonthString(int month) get Month String String monthString = ""; switch (month) { case 1: monthString = "January"; break; case 2: monthString = "February"; break; ... |
String | getPreMonthText(String pattern) get Pre Month Text Calendar c = Calendar.getInstance(); c.add(Calendar.MONTH, -1); SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(c.getTime()); |
int | month(String monthName) Convert a month name (english names) (or a valid abbreviation) to an int in {1,12}. for (int i = 0; i < months.length; i++) { String m = months[i]; if (m.startsWith(monthName)) { return i + 1; return -1; |
int | monthCalValue(String monthName) month Cal Value if (monthName.compareToIgnoreCase("Jan") == 0 || monthName.compareToIgnoreCase("January") == 0) return Calendar.JANUARY; if (monthName.compareToIgnoreCase("Feb") == 0 || monthName.compareToIgnoreCase("February") == 0) return Calendar.FEBRUARY; if (monthName.compareToIgnoreCase("Mar") == 0 || monthName.compareToIgnoreCase("March") == 0) return Calendar.MARCH; if (monthName.compareToIgnoreCase("Apr") == 0 || monthName.compareToIgnoreCase("April") == 0) return Calendar.APRIL; ... |
String | monthName(int month) month Name String monthName = ""; switch (month) { case 1: monthName = "Janvier"; break; case 2: monthName = "Fevrier"; break; ... |
String | monthName(int n) month Name switch (n) { case 1: return "January"; case 2: return "February"; case 3: return "March"; case 4: ... |
String | monthNameAbbrev(int mon) returns "jan", "feb", ..., "dec" for month number (1,2,...,12). if (mon < 1 || mon > 12) throw new IllegalArgumentException("invalid month number: " + mon); return mons[mon - 1]; |
String | toMonthNameAbreviated(int m) to Month Name Abreviated if (m == 1) return "Jan"; if (m == 2) return "Fev"; if (m == 3) return "Mar"; if (m == 4) return "Abr"; ... |