I've written a plugin that stores records in it's own table. I can see that the dateCreated and dateUpdated fields are stored in UTC.

When I want to display them in a CP template, I'm using populateModel and my model contains 'dateCreated' => AttributeType::DateTime.

If I output this with {{ entry.dateCreated|dateTime }} then I'm still getting UTC time and not BST (the Timezone in Settings).

If I use {{ entry.dateCreated|date('d M Y H:i', 'Europe/London') }} then it's correct.

Is there any way to get the date with the correct timezone set automatically?

1 Answer 1


It's a bit confusing at the moment (should be cleaner in the upcoming Craft 3), but for now, if you use {{ entry.dateCreated|date }}, it should take the timezone into account and display the correct time.

  • Thanks Brad, it is a bit confusing. I was originally using the {{ entry.dateCreated|datetime }} filter which shows UTC. If I use {{ entry.dateCreated|date('d M Y H:i') }} then I get the local output.
    – Ant Cooper
    Commented Sep 15, 2016 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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