Skip to content

Commit

Permalink
Using YYYY is the formatter is more often than not a mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Nov 10, 2015
1 parent 0dcbd3a commit 31a0466
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions en/core-libraries/time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ dates. CakePHP makes this a snap::
$now->i18nFormat([\IntlDateFormatter::FULL, \IntlDateFormatter::SHORT]);

// Outputs '2014-10-31 00:00:00'
$now->i18nFormat('YYYY-MM-dd HH:mm:ss');
$now->i18nFormat('yyyy-MM-dd HH:mm:ss');

It is possible to specify the desired format for the string to be displayed.
You can either pass `IntlDateFormatter constants
Expand Down Expand Up @@ -221,7 +221,7 @@ Likewise, it is possible to alter the default formatting string to be used for

Time::setToStringFormat([\IntlDateFormatter::FULL, \IntlDateFormatter::SHORT]);

Time::setToStringFormat('YYYY-MM-dd HH:mm:ss');
Time::setToStringFormat('yyyy-MM-dd HH:mm:ss');

It is recommended to always use the constants instead of directly passing a date
format string.
Expand Down

0 comments on commit 31a0466

Please sign in to comment.