日期:2014-05-16  浏览次数:20774 次

MySQL时间格式
MySQL在存储时间的时候,能否把它存储为特定的格式,例如:AM11:48:37?
如果能,怎么实现?

------解决方案--------------------
SQL code
mysql> insert into aa (id,name,pid,val,tm,stm) 
values(9,'AS',8,'1','2012-09-05 21:48:20',date_format('2012-09-05 21:48:20','%p%h:%m:%s'));
Query OK, 1 row affected (0.00 sec)

mysql> select * from aa;
+------+------+------+------+---------------------+------------+
| id   | name | pid  | val  | tm                  | stm        |
+------+------+------+------+---------------------+------------+
|    9 | AS   |    8 | 1    | 2012-09-05 21:48:20 | PM09:09:20 |
+------+------+------+------+---------------------+------------+
1 row in set (0.00 sec)

------解决方案--------------------
还没搞定?看看人楼上讲得多仔细