selectcurrent_timestamp();+---------------------+|current_timestamp()|+---------------------+|2010-01-1821:24:37|+---------------------+1rowinset(0.00sec)mysql>selectcurrent_date();+----------------+|current_date()|+" />

日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

MySql Date函數(shù)

系統(tǒng) 2024 0

1、獲取當(dāng)前時(shí)間

mysql> select current_timestamp();
+---------------------+
| current_timestamp() |
+---------------------+
| 2010-01-18 21:24:37 |
+---------------------+
1 row in set (0.00 sec)

mysql> select current_date();
+----------------+
| current_date() |
+----------------+
| 2010-01-18???? |
+----------------+
1 row in set (0.00 sec)

mysql> select current_time();
+----------------+
| current_time() |
+----------------+
| 21:24:46?????? |
+----------------+
1 row in set (0.00 sec)

2、Unix時(shí)間

mysql> select unix_timestamp();
+------------------+
| unix_timestamp() |
+------------------+
|?????? 1263821184 |
+------------------+
1 row in set (0.00 sec)

mysql> select from_unixtime(1263821182);
+---------------------------+
| from_unixtime(1263821182) |
+---------------------------+
| 2010-01-18 21:26:22?????? |
+---------------------------+
1 row in set (0.00 sec)

3、時(shí)間前后

mysql> select date_add(current_timestamp, interval 1 day);
+---------------------------------------------+
| date_add(current_timestamp, interval 1 day) |
+---------------------------------------------+
| 2010-01-19 21:27:53???????????????????????? |
+---------------------------------------------+
1 row in set (0.00 sec)

mysql> select date_add(current_time, interval 1 day);
+----------------------------------------+
| date_add(current_time, interval 1 day) |
+----------------------------------------+
| NULL?????????????????????????????????? |
+----------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> select date_add(current_date, interval 1 day);
+----------------------------------------+
| date_add(current_date, interval 1 day) |
+----------------------------------------+
| 2010-01-19???????????????????????????? |
+----------------------------------------+
1 row in set (0.00 sec)

mysql> select date_sub(current_timestamp, interval 1 day);
+---------------------------------------------+
| date_sub(current_timestamp, interval 1 day) |
+---------------------------------------------+
| 2010-01-17 21:28:41???????????????????????? |
+---------------------------------------------+
1 row in set (0.00 sec)

mysql> select date_sub(current_date, interval 1 day);
+----------------------------------------+
| date_sub(current_date, interval 1 day) |
+----------------------------------------+
| 2010-01-17???????????????????????????? |
+----------------------------------------+
1 row in set (0.00 sec)

mysql> select date_sub(current_time, interval 1 day);
+----------------------------------------+
| date_sub(current_time, interval 1 day) |
+----------------------------------------+
| NULL?????????????????????????????????? |
+----------------------------------------+
1 row in set, 1 warning (0.00 sec)

4、時(shí)間間隔

mysql> select datediff('2010-01-18','2010-01-17');
+-------------------------------------+
| datediff('2010-01-18','2010-01-17') |
+-------------------------------------+
|?????????????????????????????????? 1 |
+-------------------------------------+
1 row in set (0.00 sec)

mysql> select timediff('2010-01-18 12:00','2010-01-17 11:00');
+-------------------------------------------------+
| timediff('2010-01-18 12:00','2010-01-17 11:00') |
+-------------------------------------------------+
| 25:00:00??????????????????????????????????????? |
+-------------------------------------------------+
1 row in set (0.00 sec)

5、時(shí)間轉(zhuǎn)換

mysql> select time_to_sec('25:00:00');
+-------------------------+
| time_to_sec('25:00:00') |
+-------------------------+
|?????????????????? 90000 |
+-------------------------+
1 row in set (0.00 sec)

mysql> select sec_to_time(90000);
+--------------------+
| sec_to_time(90000) |
+--------------------+
| 25:00:00?????????? |
+--------------------+
1 row in set (0.00 sec)?

?

?

MySql Date函數(shù)


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 大兴区| 石渠县| 基隆市| 交城县| 合川市| 滨州市| 萨嘎县| 梧州市| 麻栗坡县| 报价| 汶川县| 长岛县| 江都市| 剑阁县| 荔浦县| 乳山市| 安福县| 彭州市| 开化县| 皋兰县| 新余市| 子长县| 绥化市| 江油市| 雷山县| 赞皇县| 新沂市| 鹤山市| 陕西省| 新安县| 麻城市| 泸西县| 灵台县| 察哈| 乌恰县| 莎车县| 田林县| 安龙县| 聊城市| 出国| 麻江县|