SimpleDateFormat sdf750 = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date dd750 = sdf750.parse("1997-05-16",new ParsePosition(0));
System.out.println(dd750);
Fri May 16 00:00:00 PDT 1997
SimpleDateFormat sdf750 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf751 = new SimpleDateFormat("yyyy/MM/dd");
sdf750.setLenient(false);
String dateString = "1997/05/16";
java.util.Date dd750 = sdf750.parse(dateString,new ParsePosition(0));
if(dd750 == null) {
System.out.println(" trying again");
dd750 = sdf751.parse(dateString,new ParsePosition(0));
}
System.out.println(dd750);
trying again
Fri May 16 00:00:00 PDT 1997
SimpleDateFormat sdf750 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf751 = new SimpleDateFormat("yyyy/MM/dd");
sdf750.setLenient(false);
sdf751.setLenient(false);
String dateString = "1997/05/16";
java.util.Date dd750 = sdf750.parse(dateString,new ParsePosition(0));
if(dd750 == null) {
System.out.println(" trying again");
dd750 = sdf751.parse(dateString,new ParsePosition(0));
}
System.out.println(dd750);
How can that be?
please, show your code