-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed as not planned
Description
Description
The following code:
<?php
$dates = ["2024-12-28", "2024-12-29", "2024-12-30", "2024-12-31", "2025-01-01"];
foreach ($dates as $date) {
$d = new \DateTime($date);
echo $date . " => " . $d->format("Y-W") . PHP_EOL;
}Resulted in this output:
2024-12-28 => 2024-52
2024-12-29 => 2024-52
2024-12-30 => 2024-01
2024-12-31 => 2024-01
2025-01-01 => 2025-01
But I expected this output instead:
2024-12-28 => 2024-52
2024-12-29 => 2024-52
2024-12-30 => 2025-01
2024-12-31 => 2025-01
2025-01-01 => 2025-01
2024-12-30 and 2024-12-31 week numbers seem to be wrong
PHP Version
PHP 8.3.13
Operating System
Ubuntu 22.04