select now();//输出当前数据库时间
select sysdate();//输出系统时间
select curdate();//输出
看看这两句 sql语句 有何不同
select end_time,goods_name
+---------------------+--------------------------+
| end_time
+---------------------+--------------------------+
| 2011-11-26 00:00:00 | 特价商品
| 2011-11-30 00:00:00 | 商品标题ffffffffffffffff |
| 2011-11-30 00:00:00 | gggggggggggggg
| 2011-11-30 00:00:00 | hhhhhhhhh
| 2011-11-30 00:00:00 | vvvvvvvvvvv
| 2011-11-30 00:00:00 | vvvvvvvvvvvvv
| 2011-11-30 00:00:00 | ffffffff
+---------------------+--------------------------+
7 rows in set
下面的这个sql输出的情况是select (end_time+0) as end,
+-----------------------+--------------------------+
| end
+-----------------------+--------------------------+
| 20111126000000.000000 | 特价商品
| 20111130000000.000000 | 商品标题ffffffffffffffff |
| 20111130000000.000000 | gggggggggggggg
| 20111130000000.000000 | hhhhhhhhh
| 20111130000000.000000 | vvvvvvvvvvv
| 20111130000000.000000 | vvvvvvvvvvvvv
| 20111130000000.000000 | ffffffff
+-----------------------+--------------------------+
7 rows in set
这里我们主要看的是时间的格式问题 ,其实mysql关于时间和日期的函数还有很多的 ,详情 你可以去查看mysql手册