Java Month stringToMonth(String m)

Here you can find the source of stringToMonth(String m)

Description

string To Month

License

Open Source License

Declaration

public static int stringToMonth(String m) 

Method Source Code

//package com.java2s;
/*// w  w w .j a  va  2s .c  o  m
BeepBeep, an event stream processor
Copyright (C) 2008-2017 Sylvain Hall?
    
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
    
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.
    
You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    public static int stringToMonth(String m) {
        if (m.compareTo("Jan") == 0)
            return 1;
        if (m.compareTo("Feb") == 0)
            return 2;
        if (m.compareTo("Mar") == 0)
            return 3;
        if (m.compareTo("Apr") == 0)
            return 4;
        if (m.compareTo("May") == 0)
            return 5;
        if (m.compareTo("Jun") == 0)
            return 6;
        if (m.compareTo("Jul") == 0)
            return 7;
        if (m.compareTo("Aug") == 0)
            return 8;
        if (m.compareTo("Sep") == 0)
            return 9;
        if (m.compareTo("Oct") == 0)
            return 10;
        if (m.compareTo("Nov") == 0)
            return 11;
        return 12;
    }
}

Related

  1. ResolveMonth(String MonthToResolve)
  2. returnMonth(String month)
  3. roundMonthUnits(final int defaultUnitValue)
  4. setStatis_month(String year_month)
  5. startDaemonThread(Runnable runnable)
  6. toAnotherMonthColor(String value, String type)
  7. toCalendarMonth(int month)
  8. toMonths(int years, int months)
  9. validateMonth(int month)