You are parsing days 31
as months. SimpleDateFormat
tries to give you a valid date. Therefore It adds to 1/0/2013 31 months. This is 2 years and 7 month. So you get your result 01/07/2015. So SimpleDateFormat
works correct.
One solution for you is to change your date pattern to M/d/yyyy h:m:s a
or your input data.
To avoid these tries you have to switch off SimpleDateFormat
lenient mode. Then you will get an exception if the format does not fit.