2012-11-20 92 views
1

如何更新日期和時間..除日期和時間以外,一切都很好。每次更新後,它們都是一樣的,永遠不會改變你認爲我的錯誤在哪裏?如何使用Google Calendar API更新日期和時間

這裏是我用來更新事件的函數。

function updateEvent ($client, $eventId, $newTitle, 
     $newDesc, $newWhere, $newStartDate, 
     $newStartTime, $newEndDate, $newEndTime, 
     $tzOffset) 
      { 
       $gdataCal = new Zend_Gdata_Calendar($client); 
       if ($eventOld = getEvent($client, $eventId)) { 
       $eventOld->title = $gdataCal->newTitle($newTitle); 
       $eventOld->where = array($gdataCal->newWhere($newWhere)); 
       $eventOld->content = $gdataCal->newContent("$newDesc"); 

       $when = $gdataCal->newWhen(); 

       if ($newStartTime!='' && $newEndTime!=''){ 
        $when->startTime = "{$newStartDate}T{$newStartTime}:00.000{$tzOffset}:00"; 
        $when->endTime = "{$newEndDate}T{$newEndTime}:00.000{$tzOffset}:00"; 
       }else { 
        $when->startTime = $newStartDate; 
        $when->endTime = $newEndDate; 
       } 

       try { 
        $eventOld->save(); 
       } catch (Zend_Gdata_App_Exception $e) { 
        var_dump($e); 
        return null; 
       } 
        return 1; 
       } else { 
       return 0; 
       } 
      } 

      if($_POST) { 

       updateEvent($client, $id, $_POST['nameBg'], $_POST['descrBg'], $_POST['place'], 
       $_POST['dateStart'], 
       $_POST['dateEnd'], 
       $_POST['timeStart'], 
       $_POST['timeEnd'], 
       '+02'); 



     $this->_helper->FlashMessenger->addMessage(array('success' => $this->_translate->_('Everything is OK.'))); 

     return $this->_helper->redirector->gotoRoute(array_merge($this->_urlCommon, array('action' => 'list')), 'lang-admin', true); 


      } 

回答

0

我發現這裏是我的問題..其實當我打電話updateEvent()我已經改變timeStart和dateEnd的地方..