MySql獲取系統時間

2021-06-21 10:47:23 字數 416 閱讀 2857

mysql獲取系統當前時間的函式

環境:mysql server 5.1

問題:mysql獲取系統當前時間的函式

解決:now()函式以'yyyy-mm-dd hh:mm:ss'返回當前的日期時間,可以直接存到datetime欄位中。

curdate()以'yyyy-mm-dd'的格式返回今天的日期,可以直接存到date欄位中。

curtime()以'hh:mm:ss'的格式返回當前的時間,可以直接存到time欄位中。

www.2cto.com  

示例:

sql:

[sql]

select now() as 當前日期時間;  

select curdate() as 今天日期;  

select curtime() as 當前時間;  

mysql 獲取系統時間

mysql select now now 2011 06 11 12 00 54 1 row in set 0.00 sec mysql select sysdate sysdate 2011 06 11 12 00 54 1 row in set 0.00 sec mysql select cur...

mysql 獲取系統時間及其格式

mysql select now now 2011 06 11 12 00 54 1 row in set 0.00 sec mysql select sysdate sysdate 2011 06 11 12 00 54 1 row in set 0.00 sec mysql select cur...

mysql 獲取系統時間(毫秒數)

sql語句 select time to sec now now current timestamp replace unix timestamp current timestamp 3 執行結果 優化版 最後乙個,就是你想要的系統毫秒數了 獲取已知日期的時間毫秒數 select unix time...