How to determine Calendar timezone in Outlook

1.2k views Asked by At

I've got this calendar time:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:20130426T133000Z
DTSTART:20130426T133000Z
DTEND:20130426T143000Z
SUMMARY:New Test
DESCRIPTION:  - http://www.domain.com/content/new-test
LOCATION:
END:VEVENT
END:VCALENDAR

And the time and date are stored in DTSTAMP, DTSTART and DTEND, however Outlook does not appear to be appending time zone information to these dates. Is there anyway to do that? I believe the Z at the end refers to "Zulu" time zone, or UTC. Am I wrong in this assumption?

How would I make Outlook recognize that a given time is in EST, and to change it if the user is in CST? Is there a way to do this easily? (I'm generating the iCal/vCal files automatically, so everything that is in this file, I have direct control over). I am using PHP to generate this file (technically it is generated by a Drupal module)

1

There are 1 answers

0
Useless Intern On BEST ANSWER

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/