mysql now函数获取当前日期与当前时间

发布时间:2020-09-21编辑:脚本学堂
本文介绍了mysql now时间函数的用法,用于取得当前日期与当前时间,包括now()、CURDATE() 、CURTIME(),需要的朋友参考下。

例子,mysql now函数的用法

mysql数据库中有三个函数,可以获取当前时间与当前日期,它们分别是now()、CURDATE() 、CURTIME()。
There are three functions that you can use to get the current date and time.
 

NOW() gets both date and time.
CURDATE() works with only the date.
CURTIME() is for the time.

sql语句如下:
 

复制代码 代码示例:
mysql> SELECT NOW();
+---------------------+
| NOW()               |
+---------------------+
| 2007-07-21 13:54:27 |
+---------------------+
1 row in set (0.00 sec)