logo       

Getting the date of an event: msg#00114

Subject: Getting the date of an event
I am having a hard time getting the date of an event.  From the code
below the retrievedEntry.getPublished() method gives me the date that
an event was "created" not the date it is on.  All I want to do is do a
search and when I find an entry just get the date is on. The
retrievedEntry.getTimes() returns a length of 0.  All entries have a
startdatetime and enddatetime. Why is this returning a length of 0?

                Query myQuery = new Query(feedUrl);

                myQuery.setFullTextQuery("Tennis");
                Feed myResultsFeed = (Feed) myService.query(myQuery, 
Feed.class);
                Calendar calendar = Calendar.getInstance();

                if (myResultsFeed.getEntries().size() > 0) {
                        Entry firstMatchEntry = (Entry) 
myResultsFeed.getEntries().get(0);
                        URL entryUrl = new 
URL(firstMatchEntry.getSelfLink().getHref());
                        EventEntry retrievedEntry = (EventEntry) 
myService.getEntry(
                                        entryUrl, EventEntry.class);
                        //The published date is the date the entry was "created"
                        
System.out.println(retrievedEntry.getPublished().toString());
                        List listofTimes = retrievedEntry.getTimes();
                        System.out.println("is empty comes back true... " +
listofTimes.isEmpty());
                        String myEntryTitle = 
retrievedEntry.getTitle().getPlainText();
                        System.out.println("the title found is..." + 
myEntryTitle);
                        DateTime d;
                        System.out.println("lenght of list is this is 0 " +
listofTimes.size());
                        for (Iterator iter = listofTimes.iterator(); 
iter.hasNext();) {
                                When element = (When) iter.next();
                                d = element.getStartTime();
                                Date dd = new Date(d.getValue());
                                calendar.setTime(dd);
                                System.out.println("Calendar" + 
calendar.getTime());
                        }
                }




<Prev in Thread] Current Thread [Next in Thread>