what is the method to find startings and endings dates of an event with google-api-php-client

73 Views Asked by At

I'm trying to get data from an event using google-api-php-client. Particulary the starting and ending date of the event.

I have tried

foreach ($event->when as $when) { ...

but nothing.

Impossible to find the documentation of google-api-php-client with all the methods. Does somebody has a link?

2

There are 2 best solutions below

0
On

There is no way of requesting just a set of events based upon a time frame. Your best bet is to just get them all then loop though them yourself. ListEvents

$events = $service->events->listEvents('primary');

Note There is a q option for searching but I don't think it works for dates. I would have to test it

Free text search terms to find events that match these terms in any field, except for extended properties. Optional.

Most of the methods have php code in the documentation Google Calendar API Refrence

0
On

This is the way :

$start = $event->getStart()->dateTime ;
$end   =  $event->getEnd()->dateTime ;

But I havent found the documentation relative to theses metods