php-src
php-src copied to clipboard
strftime wrong result
Description
The following code:
echo strftime("%A, %e %B %G %R", strtotime('2022-01-01T11:20:00Z'))."\n";
<?php
Resulted in this output:
Saturday, 1 January 2021 11:20
But I expected this output instead:
Saturday, 1 January 2022 11:20
PHP Version
PHP 7.2.24
Operating System
Centos 8
This is not a bug; %g and %G yield the ISO 8601 week-numbering year (which is suitable in combination with %V. You want to use %Y.
PHP 7.2.24
Consider to upgrade. We do not support this version anymore.