Can anybody help?
public void dateCalender() throws ParseException{
System.out.println(new SimpleDateFormat(\"MM/dd/yyyy\", Locale.ENGLISH).parse(\"120/1
On the first two:
MM/dd/yyyy 120/12/2013
The compiler will take this as '12/12/2013 + 118 months' and essentially solve for the correct date. In your example, it comes out as December 12, 2022 (12/12/2013 + 9 years).
MM/dd/yyyy 23/12/2013
The exact same thing happens. You get '12/12/2013 + 9 months', or 11/12/2014.
The third one isn't technically in the MM/dd/yyyy format. As from the other answers, you can do something like this:
SystemDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH);
sdf.setLenient(true);
sdf.parse("Jan/12/2013");
System.out.println(sdf.toString());