php-src
php-src copied to clipboard
strftime give wrong year
Description
If you run strftime() on a date in this new year, it still shows 2021 . If I put the date of today (2022-01-04), the bug disappears
The following code:
<?php
$date1 = '2022-01-01';
$date2 = '2022-01-04'; //today
echo $date1 = strftime("%d %B %G", strtotime($date1));
echo $date2 = strftime("%d %B %G", strtotime($date2));
Resulted in this output:
01 January 2021
04 January 2022
But I expected this output instead:
01 January 2022
04 January 2022
PHP Version
PHP 7.4
Operating System
No response
See https://github.com/php/php-src/issues/7864#issuecomment-1003549994