On Fri, 13 Dec 2002, Colin Bossen wrote:

> I have a similar problem. I am trying to figure out which of two dates 
> is greater. Both are in the yyyy-mm-dd format. Is there any easy 
> function that allows this sort of comparison or am I missing something?

You have a simpler problem. yyyy-mm-dd is the ISO format, and one
of the reasons it is a great format is, you can sort it any way you
like, and it just works. So the simplest way to do it is to compare
strings in alphabetic order:
if($a<$b) echo "$a earlier than $b\n";
else echo "$b earlier than $a\n";

Cheers,
Jean-Marc Libs

-- 
Give a man a fish and he will eat for a day.
Teach a man to fish and he will sit in a boat drinking beer all day.


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

Reply via email to