php - ical is importing the time by the hour, and not by the half hour -
in php i'm generating .ical timestamp. seems generating correctly when trying import the file osx's calendar, it's importing hour , not exact time. in example, time should setting 1:30pm. instead it's trying import 1:00pm. below code i'm using generate .ical , below generated .ical.
code used generate:
public function createevent($date) { $eol = "\r\n"; $ical = "begin:vcalendar" . $eol . "version:2.0" . $eol . "prodid:-//reminders/relatient//nonsgml v1.0//en" . $eol . "begin:vevent" . $eol . "uid:" . md5(uniqid(mt_rand(), true)) . "@reltient.net" . $eol . "dtstamp:" . gmdate('ymd', $date).'t'. gmdate('his', $date) . "z" . $eol . "dtstart:" . date('ymd\tgis\z', $date) . $eol . "dtend:" . date('ymd\tgis\z', $date) . $eol . "summary:appointment reminder ".date("m-d-y", $date) . $eol . "end:vevent" . $eol . "end:vcalendar"; //set correct content-type-header header('content-type: text/calendar; charset=utf-8'); header('content-disposition: inline; filename=calendar.ics'); echo $ical; exit; }
the generated file
begin:vcalendar version:2.0 prodid:-//reminders/relatient//nonsgml v1.0//en begin:vevent uid:cff16d0441e2d7d9d00a39977a8ea416@reltient.net dtstamp:20150506t013000z dtstart:20150506t13000z dtend:20150506t13000z summary:appointment reminder 05-06-2015 end:vevent end:vcalendar
why calendar not importing time down half hour, , instead importing 1:00pm 1:00pm?
edit: post following when trying create ical file: how can use php dynamically publish ical file read google calendar?
update: new generated file below (when importing calendar, it's being imported 05-05-2015 8:30pm - 8:30pm)
begin:vcalendar version:2.0 prodid:-//reminders/relatient//nonsgml v1.0//en begin:vevent uid:7813cb2429c9075704866becde76c4b7@reltient.net dtstamp:20150506t013000z dtstart:20150506t013000z dtend:20150506t013000z summary:appointment reminder 05-05-2015 end:vevent end:vcalendar
so nothing wrong php, writing .ics file. there entire section i've not seen posted in question yet there begin:vtimezone section. below updated .ics file vtimezone section. allows set timezone of file.
begin:vcalendar version:2.0 prodid:-//reminders/relatient//nonsgml v1.0//en x-wr-calname: appointment reminder calscale:gregorian begin:vtimezone tzid:america/chicago tzurl:http://tzurl.org/zoneinfo-outlook/america/chicago x-lic-location:america/chicago begin:daylight tzoffsetfrom:-0600 tzoffsetto:-0500 tzname:cdt dtstart:19700308t020000 rrule:freq=yearly;bymonth=3;byday=2su end:daylight begin:standard tzoffsetfrom:-0500 tzoffsetto:-0600 tzname:cst dtstart:19701101t020000 rrule:freq=yearly;bymonth=11;byday=1su end:standard end:vtimezone begin:vevent uid:07a982306563eda4045da725b9318d13@relatient.net dtstamp:20150512t143025z dtstart;tzid='america/chicago':20150506t133000 dtend;tzid='america/chicago':20150506t133000 summary:appointment reminder 05-06-2015 end:vevent end:vcalendar
Comments
Post a Comment