MySQL 獲取當前時間戳


1. 秒級別時間戳

自19700101 00:00:00以來按秒算,SQL如下:

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

    1
    2
    3
    4
    5
    6
    7

2. 當前時間戳

mysql> select current_timestamp();
+---------------------+
| current_timestamp() |
+---------------------+
| 2019-01-04 20:37:19 |
+---------------------+
1 row in set (0.00 sec)
————————————————
版權聲明:本文為CSDN博主「LittleLawson」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/liu16659/article/details/83834071


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM