Page 1 of 1

Comparing YYYY-MM-DD dates

Posted: Fri Apr 13, 2007 11:09 am
by mevets
I cannot figure out how to compare (earlydate < today) dates. I have dates in YYYY-MM-DD (ex. 2007-04-13) format. Most of the tutorials explain how to do this at a myqsl level, but I want to do it after my query at the php level. So what exactly must I do to compare dates in the format have them?

Posted: Fri Apr 13, 2007 11:13 am
by RobertGonzalez

Posted: Fri Apr 13, 2007 1:34 pm
by Weirdan
compare them as strings. no need for conversion here.

Code: Select all

var_dump("2004-01-02" > "2003-12-20"); // bool(true)