开发者

meeting request in ical format

I am having a form for scheduling a meeting request. and now i need to add timezones to it.

I have two dropdowns one for timezone and one for time. so if i select timezone as (GMT-11:00) Midway Island, Samoa and time as 4:00 PM than a mail goes to one person with the meeting request in his outlook.

now his outlook is configured with IST but as the timezone seleceted is new timezone so it should be adjusted appropriatedly.

$ical =    'BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER:MAILTO:'.$from_address.'
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;
 CN='.$to.':mailto:'.$to.'
DTSTART:'.$dtstart.'
DTEND:'.$dtend.'
LOCATION:'.$meeting_location.'
TRANSP:OPAQUE
SEQUENCE:0
UID:'.$cal_uid.'
DTSTAMP:'.$todaystamp.'
DESCRIPTION:'.$meeting_description.'
SUMMARY:'.$subject.'
PRIORITY:5
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR';

i have searched on it.. and it says that i have to add VTIMEZONE, TZID, TZOFFSETFROM, TZOFFSETTO now i am not getting the meaning of TZOFFS开发者_高级运维ETFROM, TZOFFSETTO...? and how to use these to execute the task


the VTIMEZONE stuff is if you want to define/redefine the timezone, when the daylight saving change is etc.

For your purposes you do not need to do that, you could just add the timezone to the timevalue for the DTSTART . :

EG: DTSTART;TZID=Europe/London:20060707T130000

or if you want a timezone for the whole ics file, you could issue a commonly accepted

X-WR-TIMEZONE:Europe/Oslo

(at calendar level in the header of the file, not in the VEVENT)

Some notes that might help:

http://icalevents.com/2613-what-every-developer-ought-to-know-about-timezones-wrt-calendar-files/

http://icalevents.com/2064-ical-local-or-floating-date-times/


Note that whatever TZID you pick (they're free format), they should have a matching entry in the VTIMEZONE section of the configuration. Contrary to what @anmari said, the VTIMEZONE section is required for the calendar event to be recognized by Outlook etc (showing accept/decline buttons).

In my experience, the smartest approach is to take (copy/paste from mail source) an existing VTIMEZONE configuration. This is the one for Western Europe, for example:

BEGIN:VTIMEZONE
TZID:W. Europe Standard Time
BEGIN:STANDARD
DTSTART:16010101T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE

Don't change anything - just copy/paste this into your email code. Now, internally we use a PHP time zone matching this one, for instance "Europe/Amsterdam". We use this as a base time zone, and convert the VEVENT's values to it using PHP's DateTime class.

$Date = new DateTime( $event_date ); // this will be in the server's time zone

// convert it to the 'internal' time zone
$Date->setTimezone( new DateTimeZone( 'Europe/Amsterdam' ) );

// ...

echo "BEGIN:VEVENT\n";
echo "DTSTART;TZID=W. Europe Standard Time:" . $Date->format( 'Ymd\THis' ) . "\n"

When sending this out, the receiving calendar/email client will automatically convert the incoming time data to the recipient's time zone. Yay! :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜