• 技术文章 >数据库 >MySQL

    MySQL获取当前时间和时间戳

    小妮浅浅小妮浅浅2021-09-01 11:05:56原创4181

    MySQL是最流行的关系型数据库管理系统,在WEB应用方面MySQL是最好的RDBMS应用软件之一。

    本次介绍中,会让大家快速掌握MySQL获取当前时间和时间戳的方法,轻松使用MySQL数据库。

    1、获得当前日期+时间(date + time)函数:now()

    MySQL> select now();
    +———————+
    | now() |
    +———————+
    | 2013-04-08 20:56:19 |
    +———————+

    除了now()函数能获得当前的日期时间外,MySQL 中还有下面的函数:

    current_timestamp()
    ,current_timestamp,localtime()
    ,localtime
    ,localtimestamp — (v4.0.6)
    ,localtimestamp() — (v4.0.6)
    MySQL 时间戳(Timestamp)函数

    2、MySQL 获得当前时间戳函数:current_timestamp, current_timestamp()

    mysql> select current_timestamp, current_timestamp();
    +——————————————+
    | current_timestamp | current_timestamp() |
    +——————————————+
    | 2008-08-09 23:22:24 | 2008-08-09 23:22:24 |
    +——————————————+

    以上就是MySQL获取当前时间和时间戳,希望对大家有所帮助。更多mysql学习指路:MySQL

    推荐操作系统:windows7系统、mysql5.8、DELL G3电脑

    专题推荐:mysql时间 时间戳
    品易云
    上一篇:问题SQL的判断和获取 下一篇:mysql如何获取hive表的元数据信息

    相关文章推荐

    • mysql执行器是什么• mysql分区表的介绍• mysql分区的应用场景• mysql触发器的缺陷分析• mysql蠕虫复制的使用场景• mysql主键冲突的解决方案• mysql查询选项如何理解• mysql字段选择是什么• mysql蠕虫复制是什么意思

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网