Issue
I'm working in CakePHP 3 and I noticed today that this:
$time = new Time('now');
$this->set('time', $time->i18nFormat('YYYY')); // echoes '2015'
Echoes 2015. Changing it to lowercase 'yyyy', instead, produces 2014.
$time = new Time('now');
$this->set('time', $time->i18nFormat('yyyy')); // echoes '2014'
Why is this the case?
Solution
Uppercase Y
is the year that the week of the timestamp is in "Week of Year" based calendars. This week now
, is in 2015 so it returns 2015. Lowercase y
is the current year for the timestamp, which for now
is 2014.
Answered By - AbraCadaver
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.