我想比较两个日期和时间,我想要所有结果 from tbl where date1 > date2
from tbl where date1 > date2
Select * From temp where mydate > '2009-06-29 04:00:44';
但这只是比较日期而不是时间。它给了我今天日期的所有结果集
'2009-06-29 11:08:57' '2009-06-29 11:14:35' '2009-06-29 11:12:38' '2009-06-29 11:37:48' '2009-06-29 11:52:17' '2009-06-29 12:12:50' '2009-06-29 12:13:38' '2009-06-29 12:19:24' '2009-06-29 12:27:25' '2009-06-29 12:28:49' '2009-06-29 12:35:54' '2009-06-29 12:36:54' '2009-06-29 12:49:57' '2009-06-29 12:58:04' '2009-06-29 04:13:20' '2009-06-29 04:56:19' '2009-06-29 05:00:23' '2009-06-29 05:04:26' '2009-06-29 05:08:17' '2009-06-29 05:26:57' '2009-06-29 05:29:06' '2009-06-29 05:32:11' '2009-06-29 05:52:07'
提前致谢!
您要显示的查询示例:
SELECT * FROM temp WHERE mydate > '2009-06-29 16:00:44';
04:00:00是4AM,所以您显示的所有结果都 在 那 之后 ,这是正确的。
如果要在下午4点之后显示所有内容,则需要在查询中使用正确的(24hr)表示法。
为了使事情更清晰,请尝试以下操作:
SELECT mydate, DATE_FORMAT(mydate, '%r') FROM temp;
这将向您显示日期及其12小时时间。