I need help with this string format: "08/13/2015 10:03:50"
I would like to compare the time within a range of 2 min. I get regex to a point but would not know how to go about this when the time is in string format and the cross over to another hour, (Ex. 10:59:30 would lap over to 11:01:30 not 10:61:30).
Code would be something like
string1 = "08/13/2015 10:03:50";
string2 = "08/13/2015 10:05:50, 08/13/2015 10:55:50, 08/13/2015 10:15:50,
08/13/2015 10:14:50, 08/13/2015 10:25:50, 08/13/2015 10:55:50";
if(string2.contains("string1(with plus or minus 2 of string1 min)"){
//Pass
}
Code I am using to grab the date
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Calendar cal = Calendar.getInstance();
String timeOfUpdate = dateFormat.format(cal.getTime());
System.out.println(timeOfUpdate);