Google calendar not recognizing DTEND

I have set up a PHP script to generate a .ics calendar file to be added to popular calendar desktop or online programs (Outlook, iCal, Gmail, etc).

I found out that the DTEND parameter is exclusive. This means events ending on 20100505 will show as ending before this date (20100504). Once I discovered this, I added one day to the end date and events display correctly in iCal.

But in Google calendar, it still shows as ending one day earlier. I have found similar questions asked around the web without any answer, though. Any idea how to work around this issue?

I am including the code below:


$query_calendar = "SELECT id, event, body, city, state, country, 
					DATE_FORMAT(date_start, '%Y%m%d') AS Fdate_start, 
					DATE_FORMAT(date_end, '%Y%m%d') AS Fdate_end 
					FROM calendar
					WHERE date_start >= '2010-01-01' 
					AND type='event' 
					ORDER BY date_start";
$result_calendar = mysql_query($query_calendar)
or die ("Couldn't execute Calendar query.");		
?>
BEGIN:VCALENDAR
PRODID:MyNameHere
X-WR-CALNAME:MyNameHere
X-WR-CALDESC:MyNameHere
VERSION:2.0
CALSCALE:GREGORIAN
<?php
while ($row_calendar = mysql_fetch_array($result_calendar))
{
extract($row_calendar);
// here we add one day to the end date because DTEND is exclusive
// meaning it considers the event ends at DTEND 00h00m00s
// not at DTEND 23h59m59s
// otherwise events will show as ending one day earlier in iCal
$tomorrow = strtotime('+1 day', strtotime($Fdate_end));
$Fdtend = date('Ymd', $tomorrow);

$h_event 	= html_entity_decode($event, ENT_QUOTES, "UTF-8");
$h_city 	= html_entity_decode($city, ENT_QUOTES, "UTF-8");
$h_country 	= html_entity_decode($country, ENT_QUOTES, "UTF-8");
?>
BEGIN:VEVENT<?php echo "\
"; ?>
SUMMARY:<?php echo $h_event; ?>
<?php echo "\
"; ?>DTSTART:<?php echo $Fdate_start; ?>
<?php echo "\
"; ?>DTEND:<?php echo $Fdtend; ?>
<?php echo "\
"; ?>LOCATION:<?php echo $h_city; if($state) { echo ", ".$state; } echo " - ".$h_country; ?>
<?php echo "\
"; ?>UID:<?php echo $id; ?>
<?php echo "\
"; ?>
URL:http://www.MyNameHere.com/events/<?php echo $id; ?>
<?php echo "\
"; ?>END:VEVENT
<?php
}
?>
END:VCALENDAR

Sounds more like an ICS issue than a php issue. Have you looked at the ICS format specification if it’s available?

I think I may have found the reason. It seems that the Google calendar doesn’t actually refreshes when you click on “Refresh”. As I let the issue sit overnight after posting my question, I discovered this morning that the events end dates were correct. I will post more info if relevant.