ID: 40271
User updated by: slomo at sonarkollektiv dot de
Reported By: slomo at sonarkollektiv dot de
Status: Bogus
Bug Type: Date/time related
Operating System: Mac OS X 10.4.8
PHP Version: 5.2.0
New Comment:
I'm sorry tony2001, but I still think I could not express
myself.
You say (and I agree):
"1999-01-04 UTC + 0 week last monday" means "1999-01-04
minus 1 week" (because 1999-01-04 is monday).
I add:
"1999-01-04 UTC + 1 week last monday" then means "1999-01-04
plus 1 week minus 1 week"
I say (and I think you have to agree):
"1999-01-11 UTC + 0 week last monday" means "1999-01-11
minus 1 week" (because 1999-01-11 is monday).
I expect:
"1999-01-04 plus 1 week minus 1 week" to be equivalent to
"1999-01-11 minus 1 week"
I expect the same value. But I don't get it.
Previous Comments:
------------------------------------------------------------------------
[2007-01-29 14:54:44] slomo at sonarkollektiv dot de
Ok, I think I got that and I did not claim anything else :-/
Are we talking about your code or my code now?
If we are talking about my example comparing strtotime
("1999-01-04 UTC + 1 week last monday") to strtotime
("1999-01-11 UTC + 0 week last monday") someone may fully
read or comment my stressed post.
If we are talking about the meaning of "1999-01-04 UTC +
**0** week last monday" I think we now just agree with each
other.
------------------------------------------------------------------------
[2007-01-29 14:45:31] [EMAIL PROTECTED]
It should be
"1999-01-04 UTC + **0** week last monday" means "1999-01-04 minus 1
week" (because 1999-01-04 is monday).
------------------------------------------------------------------------
[2007-01-29 14:38:20] slomo at sonarkollektiv dot de
> Your expectation is wrong.
> 1999-01-04 is Monday, so "last monday" for 1999-01-04 is
"1999-01-04
> minus 1 week" and "last monday" 1999-01-11 is 1999-01-04.
I still do not agree. I expect:
code :
strtotime("1999-01-04 UTC + 1 week last monday");
strtotime("1999-01-11 UTC + 0 week last monday");
1999-01-04 is monday
1999-01-11 is monday too
If you say:
"1999-01-04 UTC + 1 week last monday" means "1999-01-04
minus 1 week" (because 1999-01-04 is monday)
you forgot to mention the "+ 1 week" in the expression, this
makes "1999-01-04 minus 1 week plus 1 week" for me
= 1999-01-04 , or?
following you explanation
"1999-01-11 UTC + 0 week last monday" then means "1999-01-11
minus 1 week" (because 1999-01-11 is monday too)
and again we have to consider "+ 0 week", this makes
"1999-01-11 minus 1 week plus 0 week" for me
= 1999-01-04 , or do I miss something?
Next test:
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
> See previous explanation.
> No bug here.
This answer is even more confusing for me.
1999-01-04 is monday, correct?
no matter how you turn it, either
"1999-01-04 last monday" = 1998-12-28 + X weeks =
something with always the same gap
or
"1999-01-04" + X weeks = a date, and a monday too -> now
apply "last monday" = something with always the same gap
(we are working with a monday, no matter how you turn it, so
I expect strtotime() to behave alike, the only differing
value is the "+ X weeks")
I still expect "something with always the same gap". Sorry
for my stubbornness :(
At the moment I see that
strtotime("1999-01-11 UTC last monday + 1 week")
and
strtotime("1999-01-11 UTC + 1 week last monday")
are giving different results ... now I give up :)
Thank you for your support even more for the neat solution
using strtotime('2007W011').
------------------------------------------------------------------------
[2007-01-29 13:25:17] [EMAIL PROTECTED]
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
Your expectation is wrong.
1999-01-04 is Monday, so "last monday" for 1999-01-04 is "1999-01-04
minus 1 week" and "last monday" 1999-01-11 is 1999-01-04.
>expected result:
>at least always the same gap (604800 is a week), but it
>differs
See previous explanation.
No bug here.
------------------------------------------------------------------------
[2007-01-29 13:20:01] slomo at sonarkollektiv dot de
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.
------------------------------------------------------------------------
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