当前位置: 首页 > 工具软件 > T.js > 使用案例 >

vue日期显示格式化_js时间格式化,vue.js时间格式化,带T 时间格式化

伍宝
2023-12-01

时间格式:/Date(1567138282927)/

js格式化为日期格式:new Date(parseInt('/Date(1567138282927)/'.substr(6, 13)));

js格式化为短日期格式:new Date(parseInt('/Date(1567138282927)/'.substr(6, 13))).toLocaleDateString();

其他格式就同理

js json 带T时间格式化//处理时间

function ChangeDateFormat(jsondate) {

var date = new Date(jsondate).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');

}

vue.js就加一个过滤器就ok了:filters: {

formatDate: function (time) {

var date = new Date(parseInt(time.substr(6, 13))).toLocaleDateString();

return date;

}

}

使用{{item.CreateTime|formatDate}}

 类似资料: