I got function:
public boolean isValidDate(String inDate) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:sssZ");
dateFormat.setLenient(false);
try {
dateFormat.parse(inDate.trim());
} catch (ParseException pe) {
return false;
}
return true;
}
And I need to verify if string: '2015-01-06T10:51:26.227+0100
' is date, but funtion always return false. Could anybody tell me if my dateDormat: "yyyy-MM-dd'T'HH:mm:sssZ"
is correct?
I read a lot of questions about formatting date, but I think my dateFormat is still not correct.