Re: Date Comparison
| From: | Jason Wong | Date: | Sat, 11 Jan 2003 19:41:18 +0000 |
| Subject: | Re: Date Comparison | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131273@lists.php.net to get a copy of this message | ||
On Saturday 11 January 2003 21:38, Dhaval Desai wrote:
> Hello ppl,
>
>
> Well, I want to compate date is php, could anybody tell me which is the
> best way to do so? I have tried various ways but nothing seems consistent.
> I tried for example:
> if("2003-1-15" > "2003-1-11")
> {
> echo "true";
>
> }
> which doesn't work in some cases...
Actually the above should work in all cases as you're comparing two strings
constants :)
In any case if your dates are in ISO format (YYYY-MM-DD) then simple
comparison using >, <, ==, etc should always work fine.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
"Who cares if it doesn't do anything? It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS process ..."
*/