Msg#: 4053666 posted 11:39 pm on Jan 4, 2010 (gmt 0)
I've always used "Y-m-d H:i:s" in the date function. Have you tested to see if it's the use of "o" instead of "Y" for the year that causes the bug?
I also find that mixing PHP generated timestamps and MySQL timestamps (comparing NOW() against time()) can cause trouble. Wherever possible, I try to generate all timestamps in the same way (pseudocode):
$query = "SELECT username, chat_date FROM accounts WHERE chat_date BETWEEN (NOW() - INTERVAL 30 SECONDS) AND NOW();";
$query = "SELECT username, chat_date FROM accounts WHERE chat_date BETWEEN '".date('Y-m-d H:i:s', strtotime("-30 seconds"))."' AND '".date("Y-m-d H:i:s")."';";
Which I pick is entirely based on whether I'm feeling more sql-y that day or php-y. ;)