My Question is How to compare two time between startTime and endTime,
Comparison two time.
- Start time
- End time.
I am using the TimePickerDialog
for fetching time and I am using one method Which pass the parameter like long for startTime and endTime, I am using like this,
//Method:
boolean isTimeAfter(long startTime, long endTime) {
if (endTime < startTime) {
return false;
} else {
return true;
}
}
String strStartTime = edtStartTime.getText().toString();
String strEndTime = edtEndTime.getText().toString();
long lStartTime = Long.valueOf(strStartTime);
long lEndTime = Long.valueOf(strEndTime);
if (isTimeAfter(lStartTime, lEndTime)) {
} else {
}
Get The Error:
java.lang.NumberFormatException: Invalid long: "10:52"
How to compare two time. Please suggest me.