ID:               33229
 Updated by:       [EMAIL PROTECTED]
 Reported By:      fab097 at gmail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Feature/Change Request
 Operating System: linux
 PHP Version:      4.3.10
 New Comment:

Added to PHP 5.1 as date('o');


Previous Comments:
------------------------------------------------------------------------

[2005-06-03 11:46:04] fab097 at gmail dot com

Description:
------------
using date("Y",$date) and date("w",$date) is not clean to get the
YEARWEEK of a date.
in most of case it looks to work, for example :
with date of first or march 2005, it gives "2005" and "9"

but on certain cases, it's not possible to get REAL YearWeek of a
date.
for example : date of 30th of december 2003 is the FIRST week of year
2004 !

then date("w",$date) gives correct week number : 1
but date("Y",$date) gives year 2003 (which is normal)

a function YEARWEEK is missing.
in mySQL I have such a function :
select YEARWEEK('20031231',1); returns "200401"
there are no way in php to get such result with date.

PS : please as mysql add an optional parameters to this function to
support first day of the week. (0=sunday, 1=monday)
thank you.

Reproduce code:
---------------
$d=mktime(0,0,0,12,30,2003);
echo date("d/m/y",$d)."\n";
echo "Year :".date("Y",$d)."  Week :".date("W",$d);
echo "\n expected YEARWEEK() : '200401'";



Expected result:
----------------
 the required result of YEARWEEK future function is 200401

Actual result:
--------------
this function does not exist yet, so.. no result.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33229&edit=1

Reply via email to