public String getLowOrHighDate(String dateone, String datetwo, boolean highestDate) {
        try {

            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date date1 = sdf.parse(dateone);
            Date date2 = sdf.parse(datetwo);

            if (date1.compareTo(date2) > 0) {
                if (!highestDate) {
                    return datetwo;
                } else {
                    return dateone;

                }
            } else if (date1.compareTo(date2) < 0) {
                if (highestDate) {
                    return datetwo;
                } else {
                    return dateone;

                }
            } else if (date1.compareTo(date2) == 0) {
                return dateone;
            }

        } catch (ParseException ex) {
            ex.printStackTrace();
        }
        return dateone;
    }