Log message #4198985

# At Username Text
# Aug 20th 2019, 13:20 martin everything switching to utc would be nice
# Aug 20th 2019, 13:20 martin something to look at,
# Aug 20th 2019, 13:20 martin when I use UTC in this project, things start two hours early :P
# Aug 20th 2019, 13:19 martin :P
# Aug 20th 2019, 13:19 admad ..and that's why kids you always use UTC
# Aug 20th 2019, 13:19 martin but I did expect it was not needed to set the timezone by formatting
# Aug 20th 2019, 13:19 martin I now do `'created' => $post['created_time']->i18nFormat('YYYY-MM-dd HH:mm:ss', 'Europe/Amsterdam')` that works fine :P
# Aug 20th 2019, 13:18 martin @admad yes that is what I have now, but from facebook (via webservice) I get an UTC time, and I just did save that one, but that fails
# Aug 20th 2019, 13:03 eax @spriz Negative, just a Command/Shell listening for stuff from Redis :slightly_smiling_face:
# Aug 20th 2019, 13:02 admad specify your timezone in db config and change PHP's default timezone to the same
# Aug 20th 2019, 13:01 martin I also want to change my databases to utc, but I think this will break other things :P
# Aug 20th 2019, 13:00 martin Wish I was default :(
# Aug 20th 2019, 12:56 admad you don't need to much around with those classes if all you need to to is change deefault timezone
# Aug 20th 2019, 12:54 spriz ofc if you never use FrozenTime and FrozenDate you don't need that :slightly_smiling_face:
# Aug 20th 2019, 12:53 spriz Nope, I realize that. But I guess "default" is UTC
# Aug 20th 2019, 12:53 admad they are not there by default, you need to add those statement if you don't need UTC
# Aug 20th 2019, 12:53 spriz try dis :slightly_smiling_face: https://gist.github.com/Spriz/d396e30451ab263b98c2e3b92dffaedd
# Aug 20th 2019, 12:52 martin https://github.com/cakephp/app/blob/master/config/bootstrap.php also not in the default bootstrap?
# Aug 20th 2019, 12:51 spriz Oh well, they could be elsewhere - but we've put them there for things to apply as early as possible
# Aug 20th 2019, 12:51 martin they are not there?
# Aug 20th 2019, 12:50 spriz `Date:: setDefaultLocale()` should be in `bootstrap.php`
# Aug 20th 2019, 12:50 spriz check the values of these 3: ``` \Cake\I18n\Time::getDefaultLocale(); \Cake\I18n\I18n::getLocale(); \Cake\I18n\I18n::getDefaultLocale(); ```
# Aug 20th 2019, 12:50 martin where is the Date:: setDefaultLocale ?
# Aug 20th 2019, 12:49 martin ```Cake\I18n\Time Object ( [time] => 2019-08-01T11:30:00+00:00 [timezone] => UTC [fixedNowTime] => ) 2019-08-01 11:30:00``` but still not working
# Aug 20th 2019, 12:49 martin last two things are in bootstrap
# Aug 20th 2019, 12:48 spriz and `ini_set('intl.default_locale', Configure::read('App.defaultLocale'));` also AFAIK
# Aug 20th 2019, 12:47 spriz also make sure `date_default_timezone_set(Configure::read('App.defaultTimezone'));` is in your `bootstrap.php`
# Aug 20th 2019, 12:47 spriz I don't remember which one
# Aug 20th 2019, 12:47 spriz or `nl-NL`
# Aug 20th 2019, 12:47 spriz they should also be `nl_NL`
# Aug 20th 2019, 12:47 spriz Also check for Date::, FrozenDate::, Time:: and FrozenTime:: `setDefaultLocale()` calls
# Aug 20th 2019, 12:46 martin APP_DEFAULT_TIMEZONE is not set
# Aug 20th 2019, 12:46 spriz try setting this in `app.php`: ``` 'defaultLocale' => 'nl_NL', 'defaultTimezone' => 'Europe/Amsterdam', ```
# Aug 20th 2019, 12:45 neon1024 Hah, yeah, good point @spriz
# Aug 20th 2019, 12:45 neon1024 Try outputting a format which includes the timezone
# Aug 20th 2019, 12:45 spriz is `APP_DEFAULT_TIMEZONE` env var set to `UTC`?
# Aug 20th 2019, 12:45 neon1024 ..and output the same
# Aug 20th 2019, 12:45 neon1024 Changing that setting should save to your DB at Amsterdam time
# Aug 20th 2019, 12:44 neon1024 It shouldn’t be
# Aug 20th 2019, 12:44 martin but when I format time it will be UTC when the object is UTC
# Aug 20th 2019, 12:43 martin ``` 'defaultLocale' => env('APP_DEFAULT_LOCALE', 'nl_NL'), 'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'Europe/Amsterdam'),```