zoukankan      html  css  js  c++  java
  • 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)
    
    


    
                                        
    
  • 相关阅读:
    webform文件上传加水印
    2017-6-6 ASP.NET Ajax版页面无刷新三级联动
    2017-6-5 Ajax应用
    转【 正则表达式】
    2017-6-4 JQuery中的选择器和动画 弹窗遮罩
    Linq 组合分页查询
    2017-6-2 Linq高级查询和函数
    2017-6-3 JQuery中的Dom操作和事件
    WebForm母版页
    WebForm内置对象:Application和ViewState、Repeater的Command用法
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351609.html
Copyright © 2011-2022 走看看