<p>The above code example works.</p>

<p>Short and simple answer: <strong>daylight saving time (DST)</strong></p>

<p>Standard time: -1 hour in database</p>

<p>Daylight saving time: -2 hours in database</p>

CC BY-SA 3.0
2015-03-24T16:43:44.747Z
That's a workaround, no solution. Is it?
carlcs
CC BY-SA 3.0
2015-03-24T20:30:31.547Z
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
CC BY-SA 3.0
2015-03-24T21:15:18.360Z
Oh my goodness, now I know why: **daylight saving time**
Christian Steger
CC BY-SA 3.0
2015-03-24T21:25:23.967Z
Haha... it's always something. :)
Brad Bell
CC BY-SA 3.0
2015-03-24T16:39:06.383Z
2015-03-24T21:24:44.540Z
2015-03-24T21:24:44.540Z
Christian Steger
<p>I've found this in the <a href="http://buildwithcraft.com/docs/date-time-fields" rel="nofollow">documenation</a>:</p>

<blockquote>
  <p>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.</p>
</blockquote>

<p>That's fine.</p>

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

<p>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.</p>

<p>Here is my code snippet:</p>

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

{% cache until expiryDate %}
</code></pre>

<p><strong>Example:</strong></p>

<p>expiryDate in entry: 2015-04-01 00:00:00</p>

<p>expiryDate in cache: 2015-03-31 22:00:00</p>

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

<cache><datetime><timezone>
expiryDate in craft_templatecaches
# expiryDate in craft_templatecaches

(Asked by: username_0 on 2015-03-24)

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?

**Tags:** cache, datetime, timezone


---

## 1 answers

### Answer by username_0 on 2015-03-24. Score: 2 | Accepted answer

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

> **Comments:**
> **username_1**: That's a workaround, no solution. Is it?  
> **username_2**: 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.  
> **username_0**: Oh my goodness, now I know why: **daylight saving time**  
> **username_2**: Haha... it's always something. :)  

---

