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

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

MySql Date函數

系統 2163 0

1、獲取當前時間

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時間

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、時間前后

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、時間間隔

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、時間轉換

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函數


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

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

【本文對您有幫助就好】

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

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 琼海市| 布尔津县| 五寨县| 昂仁县| 万山特区| 长汀县| 东宁县| 金湖县| 视频| 年辖:市辖区| 天祝| 孝感市| 丰原市| 中牟县| 皋兰县| 荣成市| 正定县| 崇仁县| 达日县| 浦城县| 水富县| 伊宁市| 集贤县| 漳平市| 将乐县| 四川省| 专栏| 和硕县| 汉源县| 津南区| 古浪县| 息烽县| 绿春县| 年辖:市辖区| 阿坝县| 太和县| 二手房| 中牟县| 冕宁县| 凉城县| 道孚县|