Java Month getMonthDescription(int month)

Here you can find the source of getMonthDescription(int month)

Description

get Month Description

License

Open Source License

Declaration

public static String getMonthDescription(int month) 

Method Source Code

//package com.java2s;

public class Main {
    public static String getMonthDescription(int month) {
        return getMonthDescription(month, 0);
    }/*w w  w .j av a2 s . c  o  m*/

    public static String getMonthDescription(int month, int cutOf) {
        switch (month) {
        case 0:
            return "January".substring(0, cutOf == 0 || cutOf > "January".length() ? "January".length() : cutOf);
        case 1:
            return "February".substring(0, cutOf == 0 || cutOf > "February".length() ? "February".length() : cutOf);
        case 2:
            return "March".substring(0, cutOf == 0 || cutOf > "March".length() ? "March".length() : cutOf);
        case 3:
            return "April".substring(0, cutOf == 0 || cutOf > "April".length() ? "April".length() : cutOf);
        case 4:
            return "May".substring(0, cutOf == 0 || cutOf > "May".length() ? "May".length() : cutOf);
        case 5:
            return "June".substring(0, cutOf == 0 || cutOf > "June".length() ? "June".length() : cutOf);
        case 6:
            return "July".substring(0, cutOf == 0 || cutOf > "July".length() ? "July".length() : cutOf);
        case 7:
            return "August".substring(0, cutOf == 0 || cutOf > "August".length() ? "August".length() : cutOf);
        case 8:
            return "September".substring(0,
                    cutOf == 0 || cutOf > "September".length() ? "September".length() : cutOf);
        case 9:
            return "October".substring(0, cutOf == 0 || cutOf > "October".length() ? "October".length() : cutOf);
        case 10:
            return "November".substring(0, cutOf == 0 || cutOf > "November".length() ? "November".length() : cutOf);
        case 11:
            return "December".substring(0, cutOf == 0 || cutOf > "December".length() ? "December".length() : cutOf);
        default:
            return "";
        }
    }
}

Related

  1. getMonthBegin(String strdate)
  2. getMonthBeginByMonth(String month)
  3. getMonthBetween(String strDate, int intDiff)
  4. getMonthByDate(String yyyyMMdd)
  5. getMonthCountByBillMode(String billMode)
  6. getMonthDiff(String startDate, String endDate)
  7. getMonthEnd(String strdate)
  8. getMonthFromDate(String date)
  9. getMonthFromYM(String ym)