First you need to analyze this:
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss") Date date = sdf.parse(endTime);
Then you can create a calendar to compare time:
Calendar c = Calendar.getInstance(); c.setTime(date); Calendar now = Calendar.getInstance(); if (now.get(Calendar.HOUR_OF_DAY) > c.get(Calendar.HOUR_OF_DAY) .. etc) { .. }
Alternatively, you can create a calendar of type now and set its fields HOUR, MINUTE and SECOND using the new calendars.
With joda-time, you can do something like this.
new DateMidnight().withHour(..).widthMinute(..).isBefore(new DateTime())
Bozho source share