輸入兩個時間,計算他們相差多少天多少時,多少秒
給定兩個時間. 計算他們兩個差多了多少, 輸入的時間格式類似 '2018-11-30 11:39:10', 輸出得到的結果是 '44天 0小時 0 分鍾0 秒' 查看效果 ...
let n date new Date let l str: string .split 過去的時間 let n str: string n date.toLocaleDateString .split 當前的時間 格式: let oDate new Date l str l str l str .replace g, let oDate new Date n str n str n str . ...
2020-10-09 16:39 0 421 推薦指數:
給定兩個時間. 計算他們兩個差多了多少, 輸入的時間格式類似 '2018-11-30 11:39:10', 輸出得到的結果是 '44天 0小時 0 分鍾0 秒' 查看效果 ...
...
計算2個日期之間相差多少天 ...
在項目開發當中,我們時常碰到要比較兩個時間或者與當前時間相差多少天,多少個月,多少年的問題。 下面給大家分享一下我的整理的一個例子: 運行的結果: 2008-06-12 -- 2009-06-09 相差多少天:3622008-06-12 -- 2009-06-09 相差多少月 ...
方法一:獲取天 方法二:獲取 天,小時,分,秒 方法三:同上 方法四:比較時間大小 ...