【问题标题】:How do i retrieve all recently updated events in Google Calendar?如何在 Google 日历中检索所有最近更新的事件?
【发布时间】:2010-02-17 05:49:56
【问题描述】:

我目前正在开发一项 Google 日历同步功能,该功能应该与我们自己的日历应用程序和 Google 日历应用程序同步。现在我需要确定 Google 日历中最近的更改,以便将这些事件复制到我们的日历应用程序中。我使用 zend gdata,但我会很感激任何想法。

【问题讨论】:

    标签: php google-calendar-api


    【解决方案1】:

    (修改自http://framework.zend.com/manual/en/zend.gdata.calendar.html

    $query = $service->newEventQuery();
    $query->setUser('default');
    $query->setVisibility('private');
    $query->setProjection('full');
    $query->setOrderby('starttime');
    $query->setFutureevents('true');
    
    // Subtract time frame for when you want to detect
    // updated events, for example, in the past 24 hrs
    $refresh = time() - 60*60*24;
    $refresh_date = date('Y-m-dTH:i:sP', $refresh);
    
    $query->setUpdatedMin($refresh_date);
    
    
    // Retrieve the event list from the calendar server
    try {
        $eventFeed = $service->getCalendarEventFeed($query);
    } catch (Zend_Gdata_App_Exception $e) {
        echo "Error: " . $e->getMessage();
    }
    
    // Iterate through the list of events, outputting them as an HTML list
    echo "<ul>";
    foreach ($eventFeed as $event) {
        echo "<li>" . $event->title . " (Event ID: " . $event->id . ")</li>";
    }
    echo "</ul>";
    

    【讨论】:

    • 我想你的意思是$refresh_date = date('Y-m-dTH:i:sP', $refresh);
    猜你喜欢
    • 2016-01-23
    • 2014-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多