osx - iCaldendar - How will PHP apply the timezone, start, end time correctly on ics file? -
why following starttime
, endtime
in outlook , mac calendar not inserting exact time below?
input:
$timezone = 'europe/luxembourg'; $starttime = "2016-11-03 18:00:00"; $endtime = "2016-11-03 19:00:00";
icalender.ics:
$icalender_for_outlook_n_osx = 'begin:vcalendar' . "\r\n" . 'version:2.0'. "\r\n" . 'prodid:-//hacksw/handcal//nonsgml v1.0//en'. 'begin:vevent'. "\r\n" . 'dtend:' . date("ymd\this", strtotime($endtime)) . "\r\n" . 'uid:'. uniqid() . "@".$domain . "\r\n". 'dtstamp:'. time() . "\r\n". 'location:' . $location . "\r\n". 'description:'. $uri . "\r\n" . 'url;value=uri:' . $uri . "\r\n" . 'summary:'. $subject . "\r\n" . 'dtstart:'. date("ymd\this", strtotime($starttime)) . "\r\n" . 'priority:5'. "\r\n" . 'end:vevent'. "\r\n" . 'end:vcalendar'. "\r\n";
outlook or in mac calendar start , end time either showing several hours or forward, never getting value have embedded. how put php timezone , start/date time above input submission?
i believe strtotime()
should avoided , create date time format.
$format = 'y-m-d h:i:s'; $icalformat = 'ymd\this'; $starttime = '2016-11-03 18:00:00'; $endtime = '2016-11-03 19:00:00'; echo datetime::createfromformat($format, $starttime)->format($icalformat); // 20161103t180000 echo datetime::createfromformat($format, $endtime)->format($icalformat); // 20161103t190000
Comments
Post a Comment