public String getTimeDescription() { EventDateTime startDT = event.getStart(); EventDateTime endDT = event.getEnd(); // this field is populated if event has time if (startDT.getDateTime() != null) { return String.format( "Start: %s End: %s", formatDateTime(startDT.getDateTime()), formatDateTime(endDT.getDateTime())); } DateTime startDate = startDT.getDate(); DateTime endDate = endDT.getDate(); // special case for 1 full day event - just show the one date instead of start end final long oneDayTime = 1000 * 60 * 60 * 24; if (endDate.getValue() - startDate.getValue() == oneDayTime) return String.format("Date: %s", startDate); return String.format("Start: %s End: %s", startDate, endDate); }
public long getStartTime() { EventDateTime startDT = event.getStart(); if (startDT.getDateTime() != null) return startDT.getDateTime().getValue(); return startDT.getDate().getValue(); }