Hello Karl,

The When.getStartTime() method for an all-day event returns a
com.google.gdata.data.DateTime object which has only a date set in it
(no time or time zone info).  The Calendar.setTimeInMillis method
accepts time as milliseconds since UTC epoch (for midnight on 12/24 in
your example).  Calendar.get methods then use the timezone offsets to
determine how to shift the value returned for DAY_OF_MONTH.  Since
midnight 12/24 UTC is actually 4pm on 12/23 in pacific time (for
instance), 23 is the value returned for DAY_OF_MONTH.

The DateTime object has a method isDateOnly() which returns a boolean
to determine whether the object represents only a date (and thus
contains no time/timezone info).  You could use this information to
determine how you want to interact with the Calendar object.

Hope this helps!

Cheers,

-Ryan



On Dec 27 2006, 8:34 pm, "Karl Shea" <[EMAIL PROTECTED]> wrote:
I see that you're still having issues with your all-day events.

An all-day event on 12-24:

for (EventEntry calEntry : calFeed.getEntries())
                {
                        for (Object o : calEntry.getTimes())
                        {
                                When when = (When) o;

                                Calendar start = Calendar.getInstance();
                                
start.setTimeInMillis(when.getStartTime().getValue());
                                int day = start.get(Calendar.DAY_OF_MONTH);
                        }
                }

day will be 23.

if change to

Calendar start = Calendar.getInstance(TimeZone.getTimeZone("GMT"))

then day will be 24, which is correct.

But then non-all-day events are one day wrong.

Any suggestions, or is this a known bug?


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to