[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-bugs
Subject:    [DOC-BUGS] #46930 [Asn]: 5.3.0alpha3's strtotime() returns inconsistent result with some relative it
From:       derick () php ! net
Date:       2008-12-23 14:14:09
Message-ID: 200812231414.mBNEE9bg033152 () y1 ! php ! net
[Download RAW message or body]

 ID:               46930
 Updated by:       derick@php.net
 Reported By:      for-bugs at hnw dot jp
 Status:           Assigned
-Bug Type:         Date/time related
+Bug Type:         Documentation problem
 Operating System: any
 PHP Version:      5.3.0alpha3
 Assigned To:      derick
 New Comment:

5.3 does the proper behavior.


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

[2008-12-22 23:09:18] for-bugs at hnw dot jp

Description:
------------
strtotime() of PHP 5.3.0alpha3 returns inconsistent and incompatible
result with 'first day' 'last day' 'previous week' 'next week'.

PHP 5.2.8 produces consistent result, and meaning of 'first' 'next'
'last' 'previous' is clear for me.

The behaviour of PHP 5.3.0's strtotime() is sometimes natural, but it
lacks consistency and documentation, I think.

Reproduce code:
---------------
<?php

var_dump(date("Y-m-d", strtotime("20081224 first day")));
var_dump(date("Y-m-d", strtotime("20081224 next day")));

var_dump(date("Y-m-d", strtotime("20081224 last day")));
var_dump(date("Y-m-d", strtotime("20081224 previous day")));

var_dump(date("Y-m-d", strtotime("20081224 first week")));
var_dump(date("Y-m-d", strtotime("20081224 next week")));

var_dump(date("Y-m-d", strtotime("20081224 last week")));
var_dump(date("Y-m-d", strtotime("20081224 previous week")));

Expected result:
----------------
string(10) "2008-12-25"
string(10) "2008-12-25"
string(10) "2008-12-23"
string(10) "2008-12-23"
string(10) "2008-12-31"
string(10) "2008-12-31"
string(10) "2008-12-17"
string(10) "2008-12-17"

Actual result:
--------------
string(10) "2008-12-01"
string(10) "2008-12-25"
string(10) "2008-12-31"
string(10) "2008-12-23"
string(10) "1970-01-01"
string(10) "2008-12-29"
string(10) "2008-12-15"
string(10) "2008-12-15"


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


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


-- 
PHP Documentation Bugs Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic