Mega Code Archive

 
Categories / Java / Data Type
 

Get Date Suffix

/**********************************************************************************     Feedzeo!      A free and open source RSS/Atom/RDF feed aggregator     Copyright (C) 2005-2006  Anand Rao (anandrao@users.sourceforge.net)     This library 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 2.1 of the License, or (at your option) any later version.     This library 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 library; if not, write to the Free Software     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA ************************************************************************************/ import java.util.*; public class DateUtil {    private static String[] Months= { "Jan", "Feb", "Mar", "Apr", "May", "Jun",                                      "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };    private static String getDateSuffix( int i) {          switch (i) {             case 1: case 21: case 31:                    return ("st");             case 2: case 22:                     return ("nd");             case 3: case 23:                    return ("rd");             case 4: case 5:             case 6: case 7:             case 8: case 9:             case 10: case 11:             case 12: case 13:             case 14: case 15:             case 16: case 17:             case 18: case 19:             case 20: case 24:             case 25: case 26:             case 27: case 28:             case 29: case 30:                   return ("th");             default:                    return ("");         }    } }