Google Calendar Api get events on current week

后端 未结 2 450
无人共我
无人共我 2021-01-16 19:09

I\'m trying to get a list of events on the current week from one public Google Calendar using the Google Api.

All my configurations are good, i can do any tests, lis

2条回答
  •  青春惊慌失措
    2021-01-16 19:25

    Suppose I have 50 events on the week of 02-12-2017 to 02-18-2017. The first event starts at 5am on 02-12 and the last event starts at 8pm on 02-18. Using Central Standard Time (CST), this is how I did it:

      $service = new Google_Service_Calendar($client);
    
      $optParams = array(
        "timeMin" => "2017-02-12T05:00:00-06:00",
        "timeMax" => "2017-02-18T20:00:01-06:00"
      );
    
      $events = $service->events->listEvents('calendar@email.address', $optParams);
    
      foreach ($events->getItems() as $event) {    
    
        print $eventnum . " - Event Name: ". $event->summary . "
    "; }

    I'm not sure if the q will help to achieve this. I tried but it only worked with names and description of events, not with start times or end times. I hope this information helps.

提交回复
热议问题