On 7 Feb 2002, at 23:21, Sander Peters wrote:
> Hello,
>
>
> This is my problem:
>
> $today = date("Ymd", mktime(0,0,0, date(m),date(d),date(Y)));
> $last_week = date("Ymd", mktime(0,0,0, date(m),date(d)-7,date(Y)));
> echo ($today - $last_week); The result is a number like 8876
> (20020107-20
Sander Peters wrote:
> Hello,
>
>
> This is my problem:
>
> $today = date("Ymd", mktime(0,0,0, date(m),date(d),date(Y)));
> $last_week = date("Ymd", mktime(0,0,0, date(m),date(d)-7,date(Y)));
> echo ($today - $last_week);
> The result is a number like 8876 (20020107-20011231 = 8876)
which i
TECTED]; Martin
Towell
Subject: Re: [PHP] counting with dates (help!)
RE: [PHP] counting with dates (help!)Hi Sander,
(and Chris, and Martin)
> $today = date("Ymd", mktime(0,0,0, date(m),date(d),date(Y)));
> $last_week = date("Ymd", mktime(0,0,0, date(m),date(d)-7,date(
RE: [PHP] counting with dates (help!)Hi Sander,
(and Chris, and Martin)
> $today = date("Ymd", mktime(0,0,0, date(m),date(d),date(Y)));
> $last_week = date("Ymd", mktime(0,0,0, date(m),date(d)-7,date(Y)));
> echo ($today - $last_week);
> The result is a number lik
Well, I'll chime in as well. I'd recommend doing all your calculations
in timestamps in seconds, then convert the results into days, dates, or
whatever. If you only have a date to start with then convert to a
timestamp, do the calculation, and convert back. You could wrap it in a
function like
> $today = date("Ymd", mktime(0,0,0, date(m),date(d),date(Y)));
> $last_week = date("Ymd", mktime(0,0,0, date(m),date(d)-7,date(Y)));
> echo ($today - $last_week);
> The result is a number like 8876 (20020107-20011231 = 8876)
> But in date thinking it should be 7!
No, that's the difference in tim
You'll need to use Julian format (I think that the name for it) which is
DDD - is the year and DDD is the number of days into the year. I'm
unsure as to how to do this in PHP so you'll need to do some searching -
unless someone knows... Would be nice to know exactly how to do it in case
i
7 matches
Mail list logo