How do I check if a string contains a date of this form:
Sunday, January 15, 2012 at 7:36pm EST
The data I\'m working with contains
You could test it using the simpleDateFormat parse method. to continue your code, surround the code with a try/catch, for instance:
try {
Date date = format.parse(string);
} catch (ParseException e) {
//the string is not applicable to the date format
}
If the date is a string which follows the format guidelines in the SimpleDateFormat, the Date will be created successfully.