Date dateNow = new Date();
Calendar calendarNow = GregorianCalendar.getInstance();
calendarNow.setTime(dateNow);
JDBShifts selectedShift = (JDBShifts) jListShifts.getSelectedValue();
Calendar startCal = GregorianCalendar.getInstance();
startCal.setTime(dateNow);
startCal.set(Calendar.HOUR_OF_DAY, selectedShift.getStartTimeHours());
startCal.set(Calendar.MINUTE, selectedShift.getStartTimeMins());
startCal.set(Calendar.SECOND, selectedShift.getStartTimeSecs());
Calendar endCal = GregorianCalendar.getInstance();
endCal.setTime(dateNow);
endCal.set(Calendar.HOUR_OF_DAY, selectedShift.getEndTimeHours());
endCal.set(Calendar.MINUTE, selectedShift.getEndTimeMins());
endCal.set(Calendar.SECOND, selectedShift.getEndTimeSecs());
if (startCal.compareTo(endCal) > 0)
{
endCal.add(Calendar.DATE, 1);
}