/** * Checks whether or not the end date is before the start date of the event. * * @param endRaw The date to check in format (yyyy/MM/dd-HH:mm:ss). * @param timezone The timezone of the calendar this event is for. * @param event The event that is currently being created. * @return <code>true</code> if the end is before the start, otherwise <code>false</code>. */ public static boolean endBeforeStart(String endRaw, TimeZone timezone, PreEvent event) { if (event.getStartDateTime() != null) { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss"); sdf.setTimeZone(timezone); Date endDate = sdf.parse(endRaw); Date startDate = new Date(event.getStartDateTime().getDateTime().getValue()); return endDate.before(startDate); } catch (ParseException e) { return true; } } return false; }