mislim da je ovde glavani problem los opis u php manualu koji za funkciju date ne kaze da treba nedelja da ima vise od tri dana u toj godini da bi se smatrala prvom...
PHP manual: date
Citat:
W - ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)
|
PHP manual: strftime
Citat:
%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. (Use %G or %g for the year component that corresponds to the week number for the specified timestamp.)
|
Citat:
%W - week number of the current year as a decimal number, starting with the first Monday as the first day of the first week
|
pre svega, blues, ja bih rekao da srtftime("%W") != date("W") = strftime("%V") i da zato dobijas razlicite rezultate iz samog php-a.
ako dobro citam, date("W") bi trebalo da daje isto sto i mysql week(date, 3), bas kao sto je filjo napisao.
tvoj problem ne bi ni postojao kad bi mysql po defaultu sistemsku promenljivu default_week_format drzao na tri, sto bi onda bilo po ISO-8601. koliko vidim, default je 0.
mysql > show variables
to bi moglo da se resi tako sto bi se ta promenljiva postavila na 3
mysql > set default_date_format=3
ali ko zna sta bi sve to moglo da povuce za sobom (a i aplikacija ti zavisi od serverskih podesavanja u tom slucaju), pa je, po meni, bolje umesto date("W") koristiti strftime (posto ne vidim da date ima drugi format za nedelju sem "W"), sa formatom uskladjenim sa onim koji trazi od mysql-a.