Date and time formats are specified by pattern strings. Within the pattern strings, m
is interpreted as minute in hour, and M
is interpreted as Month in year.
Perhaps you should read JavaDoc API spec.
And you should check that the year of parsed date object is what you intended to. Since your string is MM-dd-yyy
, "02-12-014"
(which should be 2014-02-12
is actually interpreted as 0014-02-12
, which can be not your intended result.