Hi All,
I could not figure out what wrong here. even i set lenient is false. still SimpleDateFormat instance is parsing the wrong date.
Could any one please help me out???
public class DateValidation1 {
public static void main(
String[] args) {
try {
SimpleDateFormat sdf = new SimpleDateFormat () ;
sdf.applyPattern("dd/MM/yyyy") ;
sdf.setLenient(false) ;
Date formattedDate = sdf.parse("02/06/2011hcdlkjlk");
System.out.println(formattedDate) ;
} catch (ParseException e) {
System.out.println (e.getMessage()) ;
e.printStackTrace();
}
}
}