I would solve your problem like this, with the help mentioned in the comment section of your question:
public static void main(final String[] args) throws Exception {
String[] formatStrings = { "yyyy-MMM-dd", "yyyy-MM-dd", "yyyy-MMM-dd hh:mm:ss", "yyyy-MMM-dd hh:mm:ss.S" };
String yourDate = "2017-Mar-02";
Date date = null;
for (String formatString : formatStrings) {
try {
date = new SimpleDateFormat(formatString, Locale.US).parse(yourDate);
} catch (ParseException e) {
}
}
DateFormat formatTo = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssz", Locale.US);
System.out.println(formatTo.format(date));
}