Код: Выделить всё
public Date(String inString)
{
int month;// is define by cutting up the inString like this
int day; // same as month
int getSlash;
getSlash = inStr.indexOf('/');
month = Integer.parseInt(inStr.substring(0,getSlash));
day = Integer.parseInt(inStr.substring(getSlash + 1));
inStr = String.format("%02d/%02d%n",month,day);// padformatting string
inStr= new SimpleDateFormat("MM/dd").format(new SimpleDateFormat("MM/dd").parse(inStr));// checking to see if a actualdate
GregorianCalendar cal = new GregorianCalendar();
// this is what I don't understand after reading
if (month -1 > cal.get(Calendar.MONTH ) // how do I get it to say int of the month if the user types in 12 it gets invalid
{
System.out.Println("Invalid Month -> " + month");
}
}
Подробнее здесь: https://stackoverflow.com/questions/180 ... ber-months
Мобильная версия