I have just started working with the Calendar API, and I created my
start/end times with the following code:

DateTime startTime =
DateTime.parseDateTime("2006-06-23T15:00:00-05:00");
DateTime endTime = DateTime.parseDateTime("2006-06-23T17:00:00-05:00");

The event was created, but the times were off by like an hour. I
thought I read something in another thread that there may have been
some problems with the regex used in parseDateTime().

So I decided to change my code to the following:

// static imports being used
Calendar calendar = Calendar.getInstance();
calendar.set(YEAR, 2006);
calendar.set(DAY_OF_MONTH, 23);
calendar.set(MONTH, JUNE);
calendar.set(HOUR_OF_DAY, 15);
calendar.set(MINUTE, 0);

startTime = new DateTime(calendar.getTime());
calendar.set(HOUR_OF_DAT, 17);
endTime = new DateTime(calendar.getTime());

This code produced the correct times for the event.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" 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://groups.google.com/group/google-calendar-help-dataapi
-~----------~----~----~----~------~----~------~--~---

Reply via email to