给定两个时间. 计算他们两个差多了多少, 输入的时间格式类似 '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 相差多少月 ...
方法一:获取天 方法二:获取 天,小时,分,秒 方法三:同上 方法四:比较时间大小 ...