Voting

: max(four, six)?
(Example: nine)

The Note You're Voting On

kanif dot ahire at gmail dot com
6 months ago
Year is being displayed wrongly. It is displaying 2025 instead of 2024
E.g. strftime("%G-%B-%d %H:%M:%S", strtotime(date('2024-12-30 10:10:10')));
Output: 2025-December-30 10:10:10

Here G represents 4-digit year corresponding to the ISO week number. Based on this ISO week number year value will be displayed
Here B represents full month name
Here d represents day of the month (01 to 31)

Now because of this %G value we are getting the issue as ISO week number is calculated wrongly.
For example, If 30th December is falling on Monday, Tuesday, or Wednesday it is in W01 of the next year.
If it is on a Thursday, it is in W53 of the year just ending.
If on a Friday it is in W52 of the year just ending in common years and W53 in leap years.
If on a Saturday or Sunday, it is in W52 of the year just ending.
In this way week calculation happens and as 30th falls on Monday it is taking as W01 of the next year and it displays wrong year output.
For previous year no issue for this error because 30 and 31st Dec falls on sat or Sunday .

This same error occurs even if the Jan 1st falls on Friday. Then it will calculate it as W53 and displays the previous year value instead of current year.

<< Back to user notes page

To Top