mysql怎么获取当前时间

mysql怎么获取当前时间,第1张

概述mysql怎么获取当前时间

MysqL获取当前时间的方法:可以通过执行【select Now();】语句来获取当前时间。还可以通过执行【select current_timestamp, current_timestamp();】语句来获取。

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

(推荐教程:mysql视频教程)

MysqL> select Now();+---------------------+| Now() |+---------------------+| 2008-08-08 22:20:46 |+---------------------+

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

sysdate() 日期时间函数跟 Now() 类似,不同之处在于:Now() 在执行开始时值就得到了, sysdate() 在函数执行时动态得到值。看下面的例子就明白了:

MysqL> select Now(), sleep(3), Now();+---------------------+----------+---------------------+| Now() | sleep(3) | Now() |+---------------------+----------+---------------------+| 2008-08-08 22:28:21 | 0 | 2008-08-08 22:28:21 |+---------------------+----------+---------------------+

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怎么获取当前时间所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/1150764.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存