mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-14 05:16:43 +08:00
提交修改
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
|
||||
// }
|
||||
// let o = {
|
||||
// 'M+': new date(date).getMonth() +1,
|
||||
// 'M+': new date(date).getMonth() +1,
|
||||
// 'd+': date.getDate(),
|
||||
// 'h+': date.getHours(),
|
||||
// 'm+': date.getMinutes(),
|
||||
@@ -70,11 +70,16 @@ export function formatDate(date){
|
||||
// 秒转时分秒
|
||||
export function formatSeconds(value) {
|
||||
let result = parseInt(value)
|
||||
let h = Math.floor(result / 3600) < 10 ? '0' + Math.floor(result / 3600) : Math.floor(result / 3600);
|
||||
let m = Math.floor((result / 60 % 60)) < 10 ? '0' + Math.floor((result / 60 % 60)) : Math.floor((result / 60 % 60));
|
||||
let s = Math.floor((result % 60)) < 10 ? '0' + Math.floor((result % 60)) : Math.floor((result % 60));
|
||||
let d= Math.floor(result / (3600*24));
|
||||
let last=Math.floor(result % (3600*24));
|
||||
let h = Math.floor(last / 3600) < 10 ? '0' + Math.floor(last / 3600) : Math.floor(last / 3600);
|
||||
let m = Math.floor((last / 60 % 60)) < 10 ? '0' + Math.floor((last / 60 % 60)) : Math.floor((last / 60 % 60));
|
||||
let s = Math.floor((last % 60)) < 10 ? '0' + Math.floor((last % 60)) : Math.floor((last % 60));
|
||||
|
||||
let res = '';
|
||||
if(d>0){
|
||||
res += `${d}天`;
|
||||
}
|
||||
if(h !== '00'){
|
||||
res += `${h}小时`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user