tx

wangcx

栖迟於一丘,则天下不易其乐
42,868
MySQL 的 now() 函数 MySQL 的 now() 函数
now() 函数可以用来获取当前时间,可以用1~6作为参数,此时会展示毫秒,参数代表微妙时间的精度。
mysql> select now()
+---------------------+
| now()               |
+---------------------+
| 2020-04-11 11:22:06 |
+---------------------+

mysql> select now(0)
+---------------------+
| now(0)              |
+---------------------+
| 2020-04-11 11:24:30 |
+---------------------+

mysql> select now(1)
+----------------------------+
| now(1)                     |
+----------------------------+
| 2020-04-11 11:24:32.700000 |
+----------------------------+

mysql> select now(2)
+----------------------------+
| now(2)                     |
+----------------------------+
| 2020-04-11 11:24:35.830000 |
+----------------------------+

mysql> select now(3)
+----------------------------+
| now(3)                     |
+----------------------------+
| 2020-04-11 11:24:39.487000 |
+----------------------------+

mysql> select now(6)
+----------------------------+
| now(6)                     |
+----------------------------+
| 2020-04-11 11:26:09.886000 |
+----------------------------+

mysql> select now(7)
(1426, u"Too big precision 7 specified for column 'now'. Maximum is 6.")
0 条评论
user 编辑评论信息
插入图片

隐私评论

随机一言

:D 获取中...

文章目录

最新评论