"dd/MM/yyyy"
should read:
"MM/dd/yyyy"
Peter
2009-04-14 03:48:02
as Peter mentioned, the meaning of the letters can be found in the documentation here: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
The reason that it wasn't giving you what you expected is like Peter said the SimpleDateFormat
should read "MM/dd/yyyy"
The reason that the result is saying that they appear to be equal is because with the format that you've given it "dd/MM/yyyy"
, d1String
's Month is 28. It is taking 28 - 12, adding a year, 16 - 12, adding another year, and the result is 4 (April) and the year is now 2008. Same thing for d2String
.