首页图片获取,行业报告中行业新闻及详情页和新品发布及详情页接口对接完毕
This commit is contained in:
@@ -9,8 +9,40 @@ function dateFormat(time) {
|
||||
let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
||||
// 拼接
|
||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes;
|
||||
// return year + "-" + month + "-" + day;
|
||||
}
|
||||
|
||||
//时间戳转换为2022年2月2日格式
|
||||
function dateFormatDetail(time) {
|
||||
time = time * 1000
|
||||
let date = new Date(time);
|
||||
let year = date.getFullYear();
|
||||
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
|
||||
let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
||||
let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
||||
let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
||||
// 拼接
|
||||
return year + "年" + month + "月" + day + "日";
|
||||
}
|
||||
|
||||
//时间戳转换为2022-12-03 09:59
|
||||
function dateFormatXwDetail(time) {
|
||||
time = time * 1000
|
||||
let date = new Date(time);
|
||||
let year = date.getFullYear();
|
||||
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
|
||||
let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
||||
let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
||||
let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
||||
// 拼接
|
||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
dateFormat
|
||||
dateFormat,
|
||||
dateFormatDetail,
|
||||
dateFormatXwDetail
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user