Comparing YYYY-MM-DD dates
Moderator: General Moderators
Comparing YYYY-MM-DD dates
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?
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
compare them as strings. no need for conversion here.
Code: Select all
var_dump("2004-01-02" > "2003-12-20"); // bool(true)