<p>Craft stores all dates in UTC to the database, no matter what timezone you configure in settings.</p>

<p>When (user) models are populated, e.g. for use in the CP, <code>DateTime</code> objects are created from these values and the objects’ timezones are set to the one you configured.</p>

<p>If you want to output a user’s <code>dateCreated</code> attribute in a date format that includes the timezone you can easily do that in a template using the <code>date</code> Twig filter. This will return the date in ISO 8601 format using your configured default timezone.</p>

<pre><code>{{ user.dateCreated|date('c') }}
</code></pre>

<p>You can also output the date formatted for a diffenent timezone.</p>

<pre><code>{{ user.dateCreated|date('c', 'Europe/Paris') }}
</code></pre>

CC BY-SA 3.0
2017-06-13T17:28:43.743Z
2017-06-14T07:06:49.783Z
2017-06-14T07:06:49.783Z
carlcs
<p>Have a site registering users.
The user record in the CP says they registered at 11:39 June 12.</p>

<p>The database 'dateCreated' says 10:39.</p>

<p>The site settings timezone are UTC+1 BST.</p>

<p>PHP config date.timezone is Europe/London (actual location)
and Default timezone is UTC.</p>

<p>If I turn off UTC +1 in Craft timezone settings to UTC then front end user record matches database.</p>

<p>What I can't figure out for sure is what time did they really register? :)</p>

CC BY-SA 3.0
2017-06-13T15:21:20.187Z
I just learned to kinda live with it. Here in the Netherlands, 1 hour ahead of London time I have the same issue but then 2 hours ahead. Tagging along here for when there is an explanation / solution. What I'm thinking is that the amount of + hours of UTC just gets added aswell to the time it should be.
Justin Dekkers
CC BY-SA 3.0
2017-06-13T16:33:55.463Z
It looks like the server/db time is the 'real' local time and the interface just makes a change in date when setting timezone is changed. Which is a bit weird for time sensitive content.......or embargoed press releases...
joomkit
<database><datetime>
Date value different in CP and database
# Date value different in CP and database

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

Have a site registering users.
The user record in the CP says they registered at 11:39 June 12.

The database 'dateCreated' says 10:39.

The site settings timezone are UTC+1 BST.

PHP config date.timezone is Europe/London (actual location)
and Default timezone is UTC.

If I turn off UTC +1 in Craft timezone settings to UTC then front end user record matches database.

What I can't figure out for sure is what time did they really register? :)

**Tags:** database, datetime
> **Comments:**
> **username_1**: I just learned to kinda live with it. Here in the Netherlands, 1 hour ahead of London time I have the same issue but then 2 hours ahead. Tagging along here for when there is an explanation / solution. What I'm thinking is that the amount of + hours of UTC just gets added aswell to the time it should be.  
> **username_0**: It looks like the server/db time is the 'real' local time and the interface just makes a change in date when setting timezone is changed. Which is a bit weird for time sensitive content.......or embargoed press releases...  

---

## 1 answers

### Answer by username_2 on 2017-06-13. Score: 4

Craft stores all dates in UTC to the database, no matter what timezone you configure in settings.
When (user) models are populated, e.g. for use in the CP, DateTime objects are created from these values and the objects’ timezones are set to the one you configured.
If you want to output a user’s dateCreated attribute in a date format that includes the timezone you can easily do that in a template using the date Twig filter. This will return the date in ISO 8601 format using your configured default timezone.
{{ user.dateCreated|date('c') }}

You can also output the date formatted for a diffenent timezone.
{{ user.dateCreated|date('c', 'Europe/Paris') }}


---

