初始化提交
This commit is contained in:
17
js/timers.js
Normal file
17
js/timers.js
Normal file
@@ -0,0 +1,17 @@
|
||||
//将秒转化为时间戳
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user