Other than the yyyy
vs YYYY
and dd
versus DD
, the Z
is also causing a problem. Your SimpleDateFormat
with a pattern like
yyyy-MM-dd'T'HH:mm:ss.ssZ
| | | | | | | | |
| | | | | | | | -----timezone (RFC 822 time zone, ex: -0800)
| | | | | | | -------seconds again (maybe you wanted SS for milliseconds)
| | | | | | ----------seconds (0-59)
| | | | | -------------minutes (0-59)
| | | | ----------------hours (0-23)
| | | ------------------the character T
| | ---------------------day in month
| ------------------------month in year
----------------------------year
But the String you pass, "2013-03-01T11:22:18.01Z"
, simply has a Z at the end, not a timezone.
If you are actually expecting a Z
at the end, then you need to quote it in the format string:
yyyy-MM-dd'T'HH:mm:ss.ss'Z'
just like you did for T
. From the javadoc:
Text can be quoted using single quotes (') to avoid interpretation.