获得当前日期时间的mysql函数now()

数据库 MySQL
MySQL数据库提供了许多的函数供我们使用,now() 函数的作用是获得当前的日期及时间,下面就让我们一起来了解now()函数。

如果想要获得当前的日期和时间,应该如何实现呢?使用mysql函数now() ,就可以实现这项我们需要的功能,下面就为您详细介绍该mysql函数,供您参考。

mysql> select now();

+---------------------+
| now() |
+---------------------+
| 2008-08-08 22:20:46 |
+---------------------+
除了 now() 函数能获得当前的日期时间外,MySQL 中还有下面的mysql函数:

current_timestamp()
,current_timestamp
,localtime()
,localtime
,localtimestamp -- (v4.0.6)
,localtimestamp() -- (v4.0.6)
这些日期时间mysql函数,都等同于 now()。鉴于 now() 函数简短易记,建议总是使用 now() 来替代上面列出的mysql函数。

 

 

 

【编辑推荐】

带您了解mysql CONCAT()函数

修改mysql默认字符集的方法

MySQL外键在数据库中的作用

MySQL定义外键的方法

带参数的MySql存储过程

责任编辑:段燃 来源: 互联网
相关推荐

2010-09-14 16:31:24

sqlserver日期

2011-05-13 15:31:24

VC++

2010-10-09 15:07:35

MySQL日期

2010-10-11 16:35:54

MySql时间函数

2009-07-28 12:48:50

.net获得当前插入行

2010-11-25 11:01:33

MySQL日期函数

2010-05-27 13:26:20

MySQL日期时间函数

2010-08-06 11:28:51

DB2取得当前时间

2010-10-09 15:46:56

MySQL日期时间

2010-10-09 14:42:38

MySQL获取时间

2010-05-21 10:22:37

MySQL数据库

2010-08-09 16:16:58

DB2取得当前时间

2009-02-24 16:17:41

日期时间函数

2010-08-17 17:39:23

DB2取得当前时间

2010-08-13 10:50:15

DB2取得当前时间

2020-06-17 08:48:22

JavaScript开发技术

2010-08-02 10:52:31

DB2取得当前时间

2010-07-27 12:33:14

DB2数据库

2010-07-28 11:05:57

DB2数据库

2010-09-14 14:22:30

Sql Server日
点赞
收藏

51CTO技术栈公众号