Here you can find the source of convertToNumericMonth(String importStrMonth)
Parameter | Description |
---|---|
importStrMonth | Alphabet month (e.g., January) |
public static int convertToNumericMonth(String importStrMonth)
//package com.java2s; /*// ww w . j a va 2 s. c o m * ==================================================================== * Copyright (C) 1997-2008 by Naijatek.com * * All copyright notices regarding MyAlumni MUST remain * intact in the scripts and in the outputted HTML. * The "powered by" text/logo with a link back to * http://www.naijatek.com in * the footer of the pages MUST remain visible when the pages * are viewed on the internet or intranet. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Support can be obtained from support forums at: * http://www.naijatek.com/myalumni/forum * * Correspondence and Marketing Questions can be sent to: * info at naijatek com * * <p>Title: MyAlumni </p> * <p>Description: This system helps keep alive the line of communications between alumni/alumnus</p> * <p>Copyright: Copyright (c) 1997-2008</p> * <p>Company: Naijatek Solutions (http://www.naijatek.com)</p> * @author Folashade Adeyosoye (shardayyy@naijatek.com) * @version 1.0 */ public class Main { /** * Convert an alphabet month into a numeric month. * * @param importStrMonth Alphabet month (e.g., January) * @return int */ public static int convertToNumericMonth(String importStrMonth) { importStrMonth = safeString(importStrMonth); if (importStrMonth.equals("January")) { return 1; } else if (importStrMonth.equals("February")) { return 2; } else if (importStrMonth.equals("March")) { return 3; } else if (importStrMonth.equals("April")) { return 4; } else if (importStrMonth.equals("May")) { return 5; } else if (importStrMonth.equals("June")) { return 6; } else if (importStrMonth.equals("July")) { return 7; } else if (importStrMonth.equals("August")) { return 8; } else if (importStrMonth.equals("September")) { return 9; } else if (importStrMonth.equals("October")) { return 10; } else if (importStrMonth.equals("November")) { return 11; } else if (importStrMonth.equals("December")) { return 12; } else { return 0; } } /** * This method bullet proofs a string for SQL. It trims off leading and trailing * spaces, replace ' with '', and return empty string if the string is a null. * * @param inStr the unsafe string * @return String the safe string */ public static String safeString(final String inStr) { //String safeStr = null; if (inStr == null) { return ""; } //safeStr = inStr.trim().toUpperCase(); return inStr.trim(); } }