Java Month Name Get getMonthString(int month)

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

Description

get Month String

License

Apache License

Declaration

public static String getMonthString(int month) 

Method Source Code

//package com.java2s;
/**//from  w  w  w .  j  a v  a 2  s  .c  o m
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {

    public static String getMonthString(int month) {
        String monthString = "";
        switch (month) {
        case 1:
            monthString = "January";
            break;
        case 2:
            monthString = "February";
            break;
        case 3:
            monthString = "March";
            break;
        case 4:
            monthString = "April";
            break;
        case 5:
            monthString = "May";
            break;
        case 6:
            monthString = "June";
            break;
        case 7:
            monthString = "July";
            break;
        case 8:
            monthString = "August";
            break;
        case 9:
            monthString = "September";
            break;
        case 10:
            monthString = "October";
            break;
        case 11:
            monthString = "November";
            break;
        case 12:
            monthString = "December";
            break;
        default:
            monthString = "Invalid month";
            break;
        }
        return monthString;
    }
}

Related

  1. getMonthNames(Locale locale)
  2. getMonthSelect(String selectName, String value, boolean hasBlank)
  3. getMonthStr(int month)
  4. getMonthStr(int month)
  5. getMonthStr(String str)
  6. getPreMonthText(String pattern)
  7. month(String monthName)
  8. monthCalValue(String monthName)
  9. monthName(int month)