Re: checking date is not greater than today
| From: | Timothy J. Luoma | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: checking date is not greater than today | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-104628@lists.php.net to get a copy of this message | ||
On Mon, 1 Jul 2002, Peter J. Schoenster wrote:
> On 30 Jun 2002 at 22:31, Timothy J. Luoma wrote:
>
> > I am trying to compare a given date string (i.e. June 30, 2002 is
> > 20020630). I want to make sure that the input string that is given is
> > not greater than today (i.e. if today is June 30, and you ask for
> > 20020701, I want to be able to throw an error).
>
> I would question why you accept input as a particular format. It's
> certainly easier to work with timestamps than arbitrary representations
> of dates. I would not be so quick to assume you have to accept input as
> is. Or at least have it fixed to a format ... but the Perl modules I've
> worked with are liberal with what they receive .... :) Anyhow, I'd just
> find a PHP module ot handle this.
In general, the user shouldn't ever have to format the date... it's all
automatically generated.
However, wise users will look at
http://www.tntluoma.com/ethan/daily/index.php?20020701
and realize that they could possibly "look ahead" by manually editing
the URL and going to
http://www.tntluoma.com/ethan/daily/index.php?20020702
That's all I wanted to avoid. I'm using that particular date string
because it works easily with what I am trying to accomplish.
I am surprised, however, that two PHP functions would deal differently
with the way that day#-of-the-year is handled (365 vs 366).
Thanks to all who made suggestions on/off list, I believe I now have it
working.
TjL