#21572 [Bgs]: date gives 0 as a week number of year
| From: | pollita@php.net | Date: | Sat, 11 Jan 2003 01:00:04 +0000 |
| Subject: | #21572 [Bgs]: date gives 0 as a week number of year | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-29738@lists.php.net to get a copy of this message | ||
ID: 21572
Updated by: pollita@php.net
Reported By: trio@surffi.saunalahti.fi
Status: Bogus
Bug Type: Date/time related
Operating System: Redhat 8.0
PHP Version: 4.2.2
New Comment:
I should also point out that the behavior you describe in your function
does NOT replicate the proper behavior of determining the ISO-8601 week
number.
Previous Comments:
------------------------------------------------------------------------
[2003-01-10 16:53:43] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2003-01-10 16:50:14] trio@surffi.saunalahti.fi
This is a function what php needs for option to date function:
function get_a_week( $timestamp )
{
//Look the stamp for 1.1.xxxx 00:00:00 for current given stamp
$seeking_stamp = mktime( 0, 0, 0, 1, 1, date( "Y", $timestamp ) );
//Week numbers are 1-52 in practically
for( $i=1; $i < 53; $i++ )
{
//Check if the passed stamp is between monday 00:00:00 and sunday
23:59:59
if( $timestamp => $seeking_stamp and $aika <=
(($seeking_stamp+=7*24*3600)-1) )
return $i; //Found a week between 1-52
}
//Should never get here
return -1;
}
------------------------------------------------------------------------
[2003-01-10 16:48:56] iliaa@php.net
I cannot replicate this either, marking this as feedback until the user
can test with 4.3.0 or later.
------------------------------------------------------------------------
[2003-01-10 16:40:26] trio@surffi.saunalahti.fi
1) I have not that kind of platform to use right know.
2) I am GMT +02:00 timezone.
------------------------------------------------------------------------
[2003-01-10 16:34:37] pollita@php.net
Unable to reproduce with script given, output of date("W") is always >=
1 and <= 53.
(1) Could you try it with 4.3.0 and see if you get the same results?
(2) What timezone are you in?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/21572
--
Edit this bug report at http://bugs.php.net/?id=21572&edit=1