If I pass into startMin and startMax a literal string then I receive a list of all my events, but if a dynamically create the date and pass into startMin and startMax a variable I don't see the calendar events.
Below is the code:
<?php
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
/*
* $lastday = mktime(0, 0, 0, 3, 0, 2000);
* echo strftime("Last day in Feb 2000 is: %d", $lastday);
*/
$startDate = date("Y-m-d");
$currMonth = date("m");
$currYear = date("Y");
$lastday = mktime(0, 0, 0, $currMonth, 0, $currYear);
$endDay = strftime("%d", $lastday);
$endDate = date($currYear."-".$currMonth."-".$endDay);
$service = new Zend_Gdata_Calendar();
$query = $service->newEventQuery();
$query->setUser("username%40gmail.com");
$query->setVisibility('public');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setSortorder('ascending');
$query->setStartMin($startDate);
$query->setStartMax($endDate);
/**
* The below literal strings work
*/
// $query->setStartMin("2008-01-31");
// $query->setStartMax("2008-02-03");
$query->setFutureevents(false);
// Retrieve the event list from the calendar server
try {
$eventFeed = $service->getCalendarEventFeed($query);
} catch (Zend_Gdata_App_Exception $e) {
print $e->getResponse()->getBody();
}
?>
<ul>
<?php
foreach ($eventFeed as $event):
foreach ($event->getWhen() as $when):
?>
<h4><?=substr($when->startTime, 0, 10)?></h4>
<li>
content?>"><?=$event->title?></li>
<?php
endforeach;
?>
<?php
endforeach;
?>
</ul>