php - Unable to get vCalendar (vcs) to be time adjusted when opened in different time zone -


i creating .vcs file using icalcreator (v2.6) php library. when event opened in outlook (newest version, don't know other versions), meeting date/time not adjusted local time. thought might related this, setting x-microsoft-cdo-tzid value did not seem help. i'm hoping knows vcs file creation can point me in right direction. here vcs file creating:

begin:vcalendar calscale:gregorian method:publish prodid:-//127.0.53.53//nonsgml icalcreator 2.6// version:2.0 begin:vtimezone tzid:us/pacific last-modified:20040110t032845z x-microsoft-cdo-tzid:13 begin:daylight dtstart:19900404t010000 tzoffsetfrom:-0800 tzoffsetto:-0700 rrule:freq=yearly;bymonth=4;byday=1su tzname:pdt end:daylight begin:standard dtstart:19901026t060000 tzoffsetfrom:-0700 tzoffsetto:-0800 rrule:freq=yearly;bymonth=10;byday=-1su tzname:pst end:standard end:vtimezone begin:vevent uid:20170413t205736cest-5403nbu2iu@127.0.53.53 dtstamp:20170413t185736z description:sdfg\n\nsome awesome description dtstart:20170419t180000 duration:pt3h0m0s location:the best place in world summary:one fine summary end:vevent end:vcalendar 

years late, here's how works me, , maybe else happens upon question.

i've never tried tzoffsetfrom...so not sure that's or if should work. however, if put timezone in dtstart , dtend, automatically adjust. need date in utc last-modified date. ($start , $end php datetime objects):

"dtstart:".$start->settimezone(new datetimezone('utc'))->format('ymd\this\z').$eol. "dtend:".$end->settimezone(new datetimezone('utc'))->format('ymd\this\z') 

so, basically, put date utc timezone , format date/time z @ end communicate client.

a full working example (in event it's helpful anyone) is:

<?php     date_default_timezone_set('america/new_york');     //configure here     $fromname           = "john doe";     $fromemail          = "john.doe@example.com";     $toname             = "your name";     $toemail            = 'yourname@example.com';     $start              = new datetime('2017-08-15 15:00');     $end                = new datetime('2017-08-15 16:00');     $summary            = "hello world event";     //end configuration      $uid                = "0123456789";     $headers            = array();     $boundary           = "_cal_" . uniqid("b",true) . "_b_";     $headers[]          = "mime-version: 1.0";     $headers[]          = "content-type: multipart/alternative; boundary=\"".$boundary."\"";     $headers[]          = "to: \"{$toname}\" <{$toemail}>";     $headers[]          = "from: \"{$fromname}\" <{$fromemail}>";      $calendarlines      = array(         "begin:vcalendar",         "method:request",         "prodid:-//php//meetingrequest//en",         "version:2.0",         "begin:vevent",         "organizer;cn={$fromname}:mailto:{$fromemail}",         "attendee;role=req-participant;partstat=needs-action;rsvp=true;cn={$toname}:mailto:{$toemail}",         "description:{$summary}",         "summary:{$summary}",         "dtstart:".$start->settimezone(new datetimezone('utc'))->format('ymd\this\z'),         "dtend:".$end->settimezone(new datetimezone('utc'))->format('ymd\this\z'),         "uid:{$uid}",         "class:public",         "priority:5",         "dtstamp:".gmdate('ymd\this\z'),         "transp:opaque",         "status:confirmed",         "sequence:0",         "location:123 street",         "begin:valarm",         "action:display",         "description:reminder",         "trigger;related=start:-pt15m",         "end:valarm",         "end:vevent",         "end:vcalendar"     );       $calendarbase64     = base64_encode(implode("\r\n",$calendarlines));     //ensure don't have lines longer 70 characters older computers:     $calendarresult     = wordwrap($calendarbase64,68,"\n",true);      $emaillines = array(         "--{$boundary}",         "content-type: text/html; charset=\"iso - 8859 - 1\"",         "content-transfer-encoding: quoted-printable",         "",         "<html><body>",         "<h1>hello world</h1>",         "<p>this calendar event test</p>",         "</body></html>",         "",         "--{$boundary}",         "content-type: text/calendar; charset=\"utf - 8\"; method=request",         "content-transfer-encoding: base64",         "",         $calendarresult,         "",         "--{$boundary}--"     );     $emailcontent   = implode("\n",$emaillines);      $headersresult      = implode("\n",$headers);     mail($toemail, $summary, $emailcontent, $headersresult );     echo("<pre>".htmlentities($headersresult)."\n\n".htmlentities($emailcontent)."</pre>");     echo("<br /><br />");     echo("<pre>".base64_decode($calendarresult)."</pre>"); 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -