got it..hidden property in the DateTime.

DateTime dateTime = new DateTime(date);
dateTime.setDateOnly(true);

On Apr 22, 6:12 pm, tred <[email protected]> wrote:
> I'm going in circles trying to get an event created for a contact.  I
> create the contact and send it to google but receive a:
>
> "Bad Request When element does not have start date set or it&#39;s
> malformed."
>
> Seems to be related to the date of the When in the addEvent().
> Documentation says "Only the @startTime attribute is supported.
> Furthermore, its value must be a pure date, without the time
> component."
>
> Code I'm using is like this:
> ==============================================
>
> //per documentation: Exactly one of the label and rel attributes must
> be provided.
> Event event = new Event(null, Event.Rel.ANNIVERSARY) ;
>
> //convert a date string to a date
> SimpleDateFormat formatter = new SimpleDateFormat("EEE, d MMM yyyy");
> Date date = (Date)f ormatter.parse(pojo.anniversary);  // date is a
> string formatted  like "Mon, 25 Dec 2000 00:00:00 +0000"
>
> When w = new When();
> w.setStartTime( new DateTime( date ));
> x.setWhen( w );
>
> contact.addEvent(event);
>
> ==============================================
>
> What am I missing?

-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html

Reply via email to