QuickAnswer
by

The format of date retrieved by CakePHP3 is 2-digit year. Change the default to 4 digits per year.

The format of date retrieved by CakePHP3 is 2-digit year. Change the default to 4 digits per year.

In CakePHP3, the date retrieved from MySQL is somehow YY-MM-DD with two digits of the year.
Do I need to change the default settings of MySQL, or is CakePHP's default settings lacking?

This problem seems to occur in certain environments, and not necessarily in older environments.

Solution

Write the following in config/bootstrap.php.

Cake\I18n\Date::setToStringFormat('yyyy-MM-dd');
Cake\I18n\FrozenDate::setToStringFormat('yyyy-MM-dd');

It is unclear why this phenomenon occurs.

18-05-24 ---> 2018-05-24
It was displayed correctly.

CONTENTS
Web Browser