If you need to support more than one format you will have to pattern match your input and parse accordingly.
final DateFormat fmt;
if (dateString.endsWith("Z")) {
fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
} else {
fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
}
I'd guess you're dealing with a bug in the API you're using which has quoted the Z
timezone date pattern somewhere...