1

I've found this in the documenation:

Dates and times are both formatted for the user’s preferred locale. They are displayed in the site’s timezone, however they get stored in UTC like all other dates in Craft.

That's fine.

I use this timezone: UTC+1 (CET) - Europe/Rome

As expected everything is saved in the database with an UTC offset of minus one hour exept the expiryDate in the craft_templatecaches table: the UTC offset is minus two hours.

Here is my code snippet:

{% set expiredNews = craft.entries.section('news').order('expiryDate')|first %}
{% set expiryDate = expiredNews.expiryDate %}

{% cache until expiryDate %}

Example:

expiryDate in entry: 2015-04-01 00:00:00

expiryDate in cache: 2015-03-31 22:00:00

Why is there an offset of two hours and what does that mean for cache invalidation?

2

The above code example works.

Short and simple answer: daylight saving time (DST)

Standard time: -1 hour in database

Daylight saving time: -2 hours in database

4
  • That's a workaround, no solution. Is it?
    – carlcs
    Mar 24 '15 at 16:43
  • I'm not able to reproduce this locally. Using UTC+1 and the original template code and getting the proper 2015-03-26 10:00:00 in both craft_templatecaches and craft_entries->expiryDate column.
    – Brad Bell
    Mar 24 '15 at 20:30
  • Oh my goodness, now I know why: daylight saving time Mar 24 '15 at 21:15
  • Haha... it's always something. :)
    – Brad Bell
    Mar 24 '15 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.