Java Code Examples for com.google.api.services.calendar.model.EventDateTime#setDate()

The following examples show how to use com.google.api.services.calendar.model.EventDateTime#setDate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GoogleCalendarImporter.java    From data-transfer-project with Apache License 2.0 6 votes vote down vote up
private static EventDateTime getEventDateTime(CalendarEventModel.CalendarEventTime dateTime) {
  if (dateTime == null) {
    return null;
  }

  EventDateTime eventDateTime = new EventDateTime();

  // google's APIs want millisecond from epoch, and the timezone offset in minutes.
  if (dateTime.isDateOnly()) {
    eventDateTime.setDate(new DateTime(true,
        dateTime.getDateTime().toEpochSecond() * 1000,
        dateTime.getDateTime().getOffset().getTotalSeconds() / 60));
  } else {
    eventDateTime.setDateTime(new DateTime(
        dateTime.getDateTime().toEpochSecond() * 1000,
        dateTime.getDateTime().getOffset().getTotalSeconds() / 60));
  }

  return eventDateTime;
}
 
Example 2
Source File: GoogleCalendarEventModel.java    From syndesis with Apache License 2.0 5 votes vote down vote up
private EventDateTime getStart() {
    final EventDateTime start = new EventDateTime();

    if (startTime == null) {
        start.setDate(DateTime.parseRfc3339(startDate));
    } else {
        start.setDateTime(DateTime.parseRfc3339(startDate + "T" + startTime));
    }

    return start;
}
 
Example 3
Source File: GoogleCalendarEventModel.java    From syndesis with Apache License 2.0 5 votes vote down vote up
private EventDateTime getEnd() {
    final EventDateTime end = new EventDateTime();

    if (endTime == null) {
        end.setDate(DateTime.parseRfc3339(endDate));
    } else {
        end.setDateTime(DateTime.parseRfc3339(endDate + "T" + endTime));
    }

    return end;
}
 
Example 4
Source File: TestHelper.java    From syndesis with Apache License 2.0 4 votes vote down vote up
static EventDateTime date(String asString) {
    final EventDateTime dateTime = new EventDateTime();
    dateTime.setDate(DateTime.parseRfc3339(asString));

    return dateTime;
}