自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

MySQL獲取時(shí)間及日期的函數(shù)--sysdate()

數(shù)據(jù)庫(kù) MySQL
在MySQL中,使用sysdate() 函數(shù),可以獲取時(shí)間及日期的,但是和now()函數(shù)還是有所區(qū)別,淫威sysdate()在函數(shù)執(zhí)行時(shí)動(dòng)態(tài)得到值,而now() 在執(zhí)行開始時(shí)值就得到了。

如果需要讓MySQL獲取時(shí)間和日期,使用何種函數(shù)好呢?使用sysdate() 函數(shù)就可以讓MySQL獲取時(shí)間和日期,下面就讓我們來了解該函數(shù)。

MySQL獲得當(dāng)前日期+時(shí)間(date + time)函數(shù)sysdate() :

sysdate() 日期時(shí)間函數(shù)跟 now() 類似,不同之處在于:now() 在執(zhí)行開始時(shí)值就得到了, sysdate() 在函數(shù)執(zhí)行時(shí)動(dòng)態(tài)得到值??聪旅娴睦泳兔靼琢耍?/p>

mysql> select now(), sleep(3), now();

+---------------------+----------+---------------------+
| now() | sleep(3) | now() |
+---------------------+----------+---------------------+
| 2008-08-08 22:28:21 | 0 | 2008-08-08 22:28:21 |
+---------------------+----------+---------------------+mysql> select sysdate(), sleep(3), sysdate();

+---------------------+----------+---------------------+
| sysdate() | sleep(3) | sysdate() |
+---------------------+----------+---------------------+
| 2008-08-08 22:28:41 | 0 | 2008-08-08 22:28:44 |
+---------------------+----------+---------------------+
可以看到,雖然中途 sleep 3 秒,但 now() 函數(shù)兩次的時(shí)間值是相同的; sysdate() 函數(shù)兩次得到的時(shí)間值相差 3 秒。MySQL Manual 中是這樣描述 sysdate() 的:Return the time at which the function executes。

sysdate() 日期時(shí)間函數(shù),一般情況下很少用到。

 

 

【編輯推薦】

帶您了解mysql CONCAT()函數(shù)

MySQL字符串分割并拼接語句介紹

修改mysql默認(rèn)字符集的方法

MySQL刪除外鍵定義的方法

使用MySQL外鍵的四個(gè)條件

責(zé)任編輯:段燃 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-11-25 11:01:33

MySQL日期函數(shù)

2010-05-27 13:26:20

MySQL日期時(shí)間函數(shù)

2010-10-11 16:35:54

MySql時(shí)間函數(shù)

2010-10-09 15:46:56

MySQL日期時(shí)間

2009-02-24 16:17:41

日期時(shí)間函數(shù)

2010-05-21 10:22:37

MySQL數(shù)據(jù)庫(kù)

2010-10-09 14:32:23

mysql函數(shù)

2010-09-14 14:22:30

Sql Server日

2011-05-17 10:17:57

DB2日期時(shí)間函數(shù)

2010-09-14 16:31:24

sqlserver日期

2010-10-09 15:07:35

MySQL日期

2023-03-30 08:00:56

MySQL日期函數(shù)

2010-06-18 10:50:55

ms SQL Serv

2009-08-04 17:52:21

C#日期函數(shù)

2010-05-31 14:23:05

MySQL日期函數(shù)

2021-02-24 11:31:59

SQLServer數(shù)據(jù)庫(kù)時(shí)間

2010-09-27 16:38:19

Sql Server日

2010-04-29 12:23:58

Oracle 獲取系統(tǒng)

2023-03-11 22:22:04

數(shù)據(jù)庫(kù)MySQL

2010-08-25 13:46:00

DB2函數(shù)日期
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)