mysql timestamp 函数

<pre name="code" class="sql">TIMESTAMP列的显示格式与DATETIME列相同。换句话说,显示宽度固定在19字符,并且格式为YYYY-MM-DD HH:MM:SS。


select userNick,lastLoginTime from Client   where lastLoginTime>timestamp'2015-06-14 00:00:00' order by 2 desc


相当于oracle 的timestamp数据类型

mysql> insert into a2 values(1,'2015-06-11,00:00:00');
Query OK, 1 row affected (0.04 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql>  insert into a2 values(2,'2015-06-12,00:00:00');
Query OK, 1 row affected (0.00 sec)

mysql>   insert into a2 values(2,'2015-06-12,01:00:00');
Query OK, 1 row affected (0.00 sec)

mysql> commit;
Query OK, 0 rows affected (0.14 sec)

mysql> select * from a2;
+------+---------------------+
| id   | logintime           |
+------+---------------------+
|    1 | 2015-06-11 00:00:00 |
|    2 | 2015-06-12 00:00:00 |
|    2 | 2015-06-12 01:00:00 |
+------+---------------------+
3 rows in set (0.00 sec)

mysql>  select * from a2 where logintime >timestamp'2015-06-12 00:00:00';
+------+---------------------+
| id   | logintime           |
+------+---------------------+
|    2 | 2015-06-12 01:00:00 |
+------+---------------------+
1 row in set (0.00 sec)

mysql>  select * from a2 where logintime >=timestamp'2015-06-12 00:00:00';
+------+---------------------+
| id   | logintime           |
+------+---------------------+
|    2 | 2015-06-12 00:00:00 |
|    2 | 2015-06-12 01:00:00 |
+------+---------------------+
2 rows in set (0.00 sec)




                                    
原文地址:https://www.cnblogs.com/hzcya1995/p/13351609.html