I’ve a date = 2011-04-17T22:02:00.001-07:00 that I’m parsing using SDF
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
formatter.parse(date)
I It doesnt support -07:00 but -0700 works. What should change in the format?
It appears that
SimpleDateFormatdoesn’t support ISO8601 time zone formats. If you know for certain that your time zone will always end in the format of-##:##(or+##:##) then you could just remove the last:so that your existing formatter works. E.g. this parses your date:Be careful however, apparently ISO8601 allows for some variations whereby this wouldn’t work.