Reputation: 458
I give my users a link they can use to put their appointments that are on my system in their calendar software like Outlook,... using an iCalendar URL.
I generate the dates in the file using this code:
echo "DTSTART;TZID=" . date_default_timezone_get() . ":" . strftime('%Y%m%d', strtotime($app->app_start)) . 'T' . strftime('%H%M%S', strtotime($app->app_start)) . '' . $eol;
echo "DTEND;TZID=" . date_default_timezone_get() . ":" . strftime('%Y%m%d', strtotime($app->app_end)) . 'T' . strftime('%H%M%S', strtotime($app->app_end)) . '' . $eol;
This always worked correctly. But now we're in daylight saving time and all the appointments that are in daylight saving time appear 1 hour too late in my Outlook. Appointments before DST are okay.
So, for example in my ics:
DTSTART;TZID=Europe/Brussels:20150318T083000 DTEND;TZID=Europe/Brussels:20150318T090000
This shows correctly in my calendar, from 08:30 till 09:00
DTSTART;TZID=Europe/Brussels:20150407T083000 DTEND;TZID=Europe/Brussels:20150407T090000
This is my problem, this shows incorrectly in my calendar: from 09:30 till 10:30.
How can I fix this?
Upvotes: 3
Views: 5171
Reputation: 1
I got this ICS-File:
BEGIN:VCALENDAR
X-LOTUS-CHARSET:UTF-8
VERSION:2.0
PRODID:http://www.bahn.de
METHOD:PUBLISH
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:bahn2023-09-18114700
CLASS:PUBLIC
SUMMARY:Bargteheide -> Essen Hbf
DTSTART;TZID=Europe/Berlin:2023-09-18T114700
DTEND;TZID=Europe/Berlin:2023-09-18T155800
DTSTAMP:2023-07-17T081800Z
END:VEVENT
But why is it stored on the 9th of december 2022 and not on the 18th of september 2023
Upvotes: 0
Reputation: 66215
You need to make sure your ics file includes the time zone definition, e.g.
BEGIN:VTIMEZONE
TZID:US Mountain Standard Time
BEGIN:STANDARD
RRULE:FREQ=YEARLY;BYMONTH=0;BYDAY=+10SU
DTSTART:16010000T000000
TZOFFSETFROM:-0700
TZOFFSETTO:-0700
END:STANDARD
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:Eastern Standard Time
BEGIN:STANDARD
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=+11SU
DTSTART:16011101T020000
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
BEGIN:DAYLIGHT
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=+12SU
DTSTART:16010302T020000
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
END:VTIMEZONE
Upvotes: 3