[thelist] simple question about comparing dates in PHP/MySQL

Nan Harbison nan at nanharbison.com
Tue Jul 7 11:12:35 CDT 2009


Hi All,
 
This might be a stupid question, but someone was trying to tell me that you
can compare dates in the format:
2009-06-04 > 2009-05-30.
 
I thought I had to convert dates using strtotime() to compare dates, but he
said he had been doing it and it worked fine. I have found it works
sporadically.
Can anyone give me a definitive answer on this subject? I googled for it,
and most articles have you convert the date, but nowhere does any article
say you actually have to convert or why. I think it is because the date as
2009-07-7 is a string and it is doing some string comparison?
 
Thanks!
Nan
 



More information about the thelist mailing list