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'm a newbie, so I'm not sure the best way to do this.  My thought was
> that if I take the year (YYYY) and add on the day-of-year (i.e. Feb 10
> = 041) then I would be able to compare them as you would any other
> numbers.

[...] snipped

I ignored the rest as it was beyond me. I'm also a newbie to PHP but I looked into 
dates in Perl. I quickly began using a module from CPAN as I realized this was more 
complicated than meets the eye 
and you seem to indcate that when you mention leap years.

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. 

I found this:


but I'd just want a class (guess you call it that in PHP).

And then this looks real interesting:

> Date/Time Processing with PHP
> By The Disenchanted Developer
> March 19, 2002


In Perl I happen to use this moduel for date manipulation:


There must be something similar in PHP but since I too am a newbie (and lazy to boot) 
I don't know what it is. 


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to