Android Month String Get getMonthStringByIndex(int index)

Here you can find the source of getMonthStringByIndex(int index)

Description

get Month String By Index

License

Apache License

Declaration

public static String getMonthStringByIndex(int index) 

Method Source Code

//package com.java2s;
/*/*ww  w .  j a  v a2 s .co  m*/
 * Copyright 2015 Lunci Hua
 *
 * Licensed 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 getMonthStringByIndex(int index) {
        switch (index) {
        case 1:
            return "Jan";
        case 2:
            return "Feb";
        case 3:
            return "Mar";
        case 4:
            return "Apr";
        case 5:
            return "May";
        case 6:
            return "Jun";
        case 7:
            return "Jul";
        case 8:
            return "Aug";
        case 9:
            return "Sep";
        case 10:
            return "Oct";
        case 11:
            return "Nov";
        case 12:
            return "Dec";
        default:
            return "";
        }
    }
}

Related

  1. getCurMonthStr()
  2. getLastMonthStr()
  3. getMonthBefore(String format)
  4. getMonthString(int month, int abbrev)
  5. getReadableMonth(int month)
  6. getCurrentMonth()
  7. getMonthNames()
  8. getMonthNames(Locale l, int len)