Files
damuyunHome/js/timers.js

18 lines
577 B
JavaScript
Raw Permalink Normal View History

2024-07-04 15:22:53 +08:00
//将秒转化为时间戳
function timestampToTime(seconds){
var date = new Date(seconds*1000)
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var currentTime = year + "-" + month + "-" + day ;
return currentTime
}
//过滤字符串中所有html标签
function filterHTMLTag(str) {
str = str.replace(/<\/?[^>]*>/g, ''); //去除HTML tag
str = str.replace(/[ | ]*\n/g, '\n'); //去除行尾空白
str = str.replace(/ /ig, ''); //去掉
return str;
}