ID: 40271
User updated by: slomo at sonarkollektiv dot de
Reported By: slomo at sonarkollektiv dot de
Status: Open
Bug Type: Date/time related
Operating System: Mac OS X 10.4.8
PHP Version: 5.2.0
New Comment:
Just to point out why I think somethings weird, compare the
previous code and result to this one.
code:
strtotime('2000-01-04 UTC + 1 week last monday');
strtotime('2000-01-11 UTC + 0 week last monday');
actual result:
947462400
947462400
expected result:
947462400
947462400
> same value, fine.
And the same for
code:
strtotime('2000-01-04 UTC + 0 week last monday');
strtotime('2000-01-04 UTC + 1 week last monday');
strtotime('2000-01-04 UTC + 2 week last monday');
actual result:
946857600
947462400
948067200
expected result:
946857600
947462400
948067200
> always the same gap (604800 is a week), fine.
Previous Comments:
[2007-01-29 12:22:42] slomo at sonarkollektiv dot de
code :
strtotime('1999-01-04 UTC + 1 week last monday');
strtotime('1999-01-11 UTC + 0 week last monday');
actual result:
916012800
915408000
expected result:
at least the same value
Another example
code :
strtotime('1999-01-04 UTC + 0 week last monday');
strtotime('1999-01-04 UTC + 1 week last monday');
strtotime('1999-01-04 UTC + 2 week last monday');
actual result:
914803200
916012800
916617600
expected result:
at least always the same gap (604800 is a week), but it
differs
[2007-01-29 12:02:37] slomo at sonarkollektiv dot de
thanks [EMAIL PROTECTED], that's brilliant :)
and it seems to be bug free. I still think my code produced a
bug in PHP and I do not get why this happens.
[2007-01-29 12:01:58] [EMAIL PROTECTED]
Could you please just paste something like this:
code :
strftime("")
actual result:
expected result:
I really don't think those functions, cycles and HTML output are
required to demonstrate a problem with strftime().
[2007-01-29 11:55:33] slomo at sonarkollektiv dot de
My "Reproduce code" was quite complete. Here it is again,
this time it starts with :-)
I expect: using strtotime("last monday") should behave
always the same. If you run my code you will see that it
differs depending on the given date. My code is not complex,
so I hope you get the point very soon.
This "Day of week items" are a little bit confusing, because
if you have e.g. a $date for a monday and state strtotime
("$date last monday"), you get $date. I assume this is
correct.
Anyway I would think it's just my fault if my function would
be "off 1 week" for the whole year if the date is a monday
every time. But this happens only for the first week, in any
other week the result is like I learned strtotime() is doing
it.
Can you follow?
\n";
if ($w != gmstrftime('%V', $start) || $y !=
gmstrftime('%G', $start)) {
echo 'Oops,
EXCEPTIONAL ERROR!' . "\n";
}
}
echo "\n";
}
?>
best regards,
slomo
[2007-01-29 11:50:06] [EMAIL PROTECTED]
You can also just use "strtotime('2007W011')"; for Monday "1", of Week
1 ("01") of year 2007 ("2007").
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/40271
--
Edit this bug report at http://bugs.php.net/?id=40271&edit=1