private Calendar parseCalendar(String string) throws ParseException {
  Calendar cal=new GregorianCalendar(TimeZone.getTimeZone("GMT"));
  SimpleDateFormat sdf2=new SimpleDateFormat("dd.MM.yy");
  SimpleDateFormat sdf4=new SimpleDateFormat("dd.MM.yyyy");
  sdf2.setLenient(false);
  sdf4.setLenient(false);
  Date date;
  try {
    date=sdf2.parse(string);
  }
 catch (  ParseException e) {
    date=sdf4.parse(string);
  }
  cal.setTime(date);
  return cal;
}

private Calendar parseCalendar ( String string ) throws ParseException { Calendar cal = new GregorianCalendar ( TimeZone . getTimeZone ( "GMT" ) ) ; SimpleDateFormat sdf2 = new SimpleDateFormat ( "dd.MM.yy" ) ; SimpleDateFormat sdf4 = new SimpleDateFormat ( "dd.MM.yyyy" ) ; sdf2 . setLenient ( false ) ; sdf4 . setLenient ( false ) ; Date date ; try { date = sdf2 . parse ( string ) ; } catch ( ParseException e ) { date = sdf4 . parse ( string ) ; } cal . setTime ( date ) ; return cal ; }
accepts both dd . mm . yy and dd . mm . yyyy formats
