Bug #16536 Updated: Give me inconsisten results
| From: | james at jimijon dot com | Date: | Thu, 11 Apr 2002 15:36:15 +0000 |
| Subject: | Bug #16536 Updated: Give me inconsisten results | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-4674@lists.php.net to get a copy of this message | ||
ID: 16536
Updated by: james@jimijon.com
Reported By: james@jimijon.com
Status: Bogus
Bug Type: Date/time related
Operating System: mac os x
PHP Version: 4.1.2
New Comment:
No, just trying to get a consistently working numeric date for the
Sunday of that week. yymmdd
Though a previos algorithm I had:
echo "last sunday: ".date("ymd",
mktime(0,0,0,$mnth,$dy-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr))."<br
is working this week properly, but has in the past worked inproperly..
there is something really goofy going on with the date math in php.
Anyone have a ultra reliable Sunday of the Week algorithm?
Previous Comments:
------------------------------------------------------------------------
[2002-04-11 05:35:21] hholzgra@php.net
daylight saving time?!
use mktime(12,0,0,...) if you are interested in the date only
------------------------------------------------------------------------
[2002-04-10 16:43:37] james@jimijon.com
#get the numeric sunday
$today_var = getdate();
$today_sec =
mktime(0,0,0,date("m"),date("d"),date("Y"));
$offset = $today_var[wday] * 86400 ;
$first_day = $today_sec - $offset;
$this_week_first_date = date("ymd", $first_day);
$path=$this_week_first_date;
this just won't get me Sunday this week.. 020407
suddenly at midnight on Monday the 8th it went to 06, this has been
running fine for many many weeks now.
Help
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16536&edit=1