愚者樹屋

|
Home About Contact
|

series

3d軟體 (1) apache (1) css (4) godot (8) google-api (1) google翻譯 (1) html (6) hugo安裝 (7) javasciprt (1) javascript (14) jquery (3) mysql (9) notepad++ (1) php (33) python (1) unity (1) yt-dlp (1) 像素畫 (1) 免費軟體 (8) 壓力測試 (2) 弱點掃描修補 (1) 無障礙網站 (1) 社群網站 (1) 遊戲推薦 (5) 雜記 (1)

Tags

2d軟體 3d軟體 ai apache css godot google-api google翻譯 html hugo javasciprt javascript jquery mysql notepad++ php python tcpdf unity vroid

mysql 時間計算

post date - 2024/09/14
last update - 2024/09/14

工作時碰到了需要計算時間差天數的搜尋條件,記錄一下在mysql中計算時間差的功能。

方法

使用TIMESTAMPDIFF來計算,第一個是回傳的時間單位,後方可使用表格欄位

SELECT TIMESTAMPDIFF(SECOND, '2012-06-06 13:13:55', '2012-06-06 15:20:18')

回傳的時間單位可以參考這個網站的Unit欄位,比較常用的大概會是DAY(天數)
https://mariadb.com/kb/en/date-and-time-units/

參考資料

https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_timestampdiff

Tags : mysql

series

3d軟體 (1) apache (1) css (4) godot (8) google-api (1) google翻譯 (1) html (6) hugo安裝 (7) javasciprt (1) javascript (14) jquery (3) mysql (9) notepad++ (1) php (33) python (1) unity (1) yt-dlp (1) 像素畫 (1) 免費軟體 (8) 壓力測試 (2) 弱點掃描修補 (1) 無障礙網站 (1) 社群網站 (1) 遊戲推薦 (5) 雜記 (1)

Tags

2d軟體 3d軟體 ai apache css godot google-api google翻譯 html hugo javasciprt javascript jquery mysql notepad++ php python tcpdf unity vroid

Recent Posts

php curl Moved Permanently解決方法

2023/01/14

javascript鎖定右鍵

2022/07/02

php tcpdf 字形

2023/12/02

html 空白

2023/07/08

網站嵌入google翻譯(舊版本)

2023/11/25

mastodon misskey pixiv plurk twitter 巴哈姆特

© 2022-2026 愚者樹屋