<p>This sounds like that CalFileParser library you are using has some issues with timezones. There is a pull-request that supposedly fixes these, but I would rather exchange it for another library.</p>

<p><a href="https://github.com/u01jmg3/ics-parser" rel="nofollow noreferrer">https://github.com/u01jmg3/ics-parser</a> has the more modern codebase, seems to be actively maintained, more used, and can be installed using composer.</p>

CC BY-SA 3.0
2017-04-13T14:24:18.727Z
Thanks @carlcs - indeed was a problem with the CalFileParser plugin. There was a [recent Pull Request](https://github.com/controlz/CalFileParser/pulls) that updating to resolved.

When time permits will try to move to a more recent codebase.
Cole Henley
CC BY-SA 3.0
2017-04-13T14:21:01.610Z
2017-04-13T14:21:01.610Z
carlcs
<p>Has anyone got any experience working with iCal feeds - I have written a plugin utilising the <a href="https://github.com/controlz/CalFileParser" rel="nofollow noreferrer">CalFileParser library</a> but the UK clock changes have thrown all the items out, so eg an all day event is now showing up as at 11pm the day before. For example:</p>

<p><code>
BEGIN:VEVENT
DTEND:20170418T230000Z
DTSTAMP:20170412T114209Z
DTSTART:20170418T230000Z
SEQUENCE:0
SUMMARY:F4 Careers Day
UID:65d28288-9ba7-404c-85fe-b66682e2f605
END:VEVENT
</code></p>

<p>Is importing as 23:00 on 18/04/2017. However importing the feed into Calendar (Mac) is reporting the event as expected at 00:00 on 19/04/2017.</p>

<p>If I update my site settings to BST (UTC+1) and parse the value into a DateTime object then it outputs to screen correctly, eg:</p>

<p><code>$tmp = DateTime::createFromString($item['dtstart']-&gt;date);</code></p>

<p>Outputs:</p>

<p><code>Craft\DateTime Object ( [date] =&gt; 2017-04-19 00:00:00.000000 [timezone_type] =&gt; 3 [timezone] =&gt; Europe/London )</code></p>

<p>However, on saving to my database record (to a column with AttributeType::DateTime) this date value is saved as <code>2017-04-18 23:00:00</code>. This means that any attempt to retrieve and show this on my site outputs the wrong date/time.</p>

<p>Any thoughts on how to get my script to acknowledge the time difference and save this to the relevant record without having to tinker with the code every 6 months?</p>

<p>Cole</p>

<plugin-development><datetime><import><timezone><feed>
iCal feed import - Timezone query
# iCal feed import - Timezone query

(Asked by: username_0 on 2017-04-13)

Has anyone got any experience working with iCal feeds - I have written a plugin utilising the [CalFileParser library](https://github.com/controlz/CalFileParser) but the UK clock changes have thrown all the items out, so eg an all day event is now showing up as at 11pm the day before. For example:

`BEGIN:VEVENT
DTEND:20170418T230000Z
DTSTAMP:20170412T114209Z
DTSTART:20170418T230000Z
SEQUENCE:0
SUMMARY:F4 Careers Day
UID:65d28288-9ba7-404c-85fe-b66682e2f605
END:VEVENT`

Is importing as 23:00 on 18/04/2017. However importing the feed into Calendar (Mac) is reporting the event as expected at 00:00 on 19/04/2017.

If I update my site settings to BST (UTC+1) and parse the value into a DateTime object then it outputs to screen correctly, eg:

`$tmp = DateTime::createFromString($item['dtstart']->date);`

Outputs:

`Craft\DateTime Object ( [date] => 2017-04-19 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/London )`

However, on saving to my database record (to a column with AttributeType::DateTime) this date value is saved as `2017-04-18 23:00:00`. This means that any attempt to retrieve and show this on my site outputs the wrong date/time.

Any thoughts on how to get my script to acknowledge the time difference and save this to the relevant record without having to tinker with the code every 6 months?

Cole

**Tags:** plugin-development, datetime, import, timezone, feed


---

## 1 answers

### Answer by username_1 on 2017-04-13. Score: 2 | Accepted answer

This sounds like that CalFileParser library you are using has some issues with timezones. There is a pull-request that supposedly fixes these, but I would rather exchange it for another library.

<https://github.com/u01jmg3/ics-parser> has the more modern codebase, seems to be actively maintained, more used, and can be installed using composer.

> **Comments:**
> **username_0**: Thanks @username_1 - indeed was a problem with the CalFileParser plugin. There was a [recent Pull Request](https://github.com/controlz/CalFileParser/pulls) that updating to resolved.  When time permits will try to move to a more recent codebase.  

---

