TransWikia.com

Timezone in Craft different from timezone in plugin

Craft CMS Asked by Stian Karlsen on August 6, 2020

In general.php I’ve set 'timezone' => 'Europe/Oslo'.

When saving entries through the CP they are saved with the correct time. Also, date_default_timezone_get() from my plugin returns Europe/Oslo.

However when I save something via the plugin, e.g.

$something = new Something();
...
$something->save();

the dateCreated field saves with the wrong time. In my case; 2 hours earlier than the Europe/Oslo time.

What am I missing here?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP