From:             fab097 at gmail dot com
Operating system: linux
PHP version:      4.3.10
PHP Bug Type:     Feature/Change Request
Bug description:  geting a YearWeek correctly

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 bug report at http://bugs.php.net/?id=33229&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33229&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33229&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33229&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33229&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33229&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33229&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33229&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33229&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33229&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33229&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33229&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33229&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33229&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33229&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33229&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33229&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33229&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33229&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33229&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33229&r=mysqlcfg

Reply via email to