February 1, 2009

Add an all-day event to Google Calendar with Google Data Java API

The Google Data API contains the DateTime class for specifying a date and time value. But what if we don't care about the time, because we want to create an all-day event? That is easy, we must use the setDateOnly method. Here is a little code snippet which shows this:

import com.google.gdata.data.DateTime;
import java.util.Date;

final DateTime date = new DateTime(new Date());