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?