20130426 -- This is YYYYMMDD format 133000Z - 1330 is the time is GMT 00Z is just some extra text
Heh, I was just working on this this week here is the code I use to do it:
// DISPLAY CALENDER EVENT
$startdate = date('Ymd',strtotime($startdate)); //needs the YYYYMMDD format
$enddate = date('Ymd',strtotime($enddate)); //ends the day before the set date. So the date range is startdate(inclusive) -> enddate(exclusive)
$startTime = gmdate('Hi',mktime($startminutes,$startseconds)); // This is in greenwhich mean time. Have the users input time normally and simply
//explode on :
$endTime = gmdate('Hi',mktime($endminutes,$endseconds));
$subject = 'yeah';
$desc = 'come to this meeting';
$location = 'wherever';
$ical = "BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:" . md5(uniqid(mt_rand(), true))."
DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
DTSTART:".$startdate."T".$startTime."00Z
DTEND:".$enddate."T".$endTime."00Z
LOCATION:$location
SUMMARY:".$subject."
DESCRIPTION:".$desc."
END:VEVENT
END:VCALENDAR";
//set correct content-type-header
header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: inline; filename=calendar.ics');
echo $ical;
This site helped make this: http://www.daveismyname.com/development/adding-events-to-microsoft-outlook-from-php-using-ical/