0
点赞
收藏
分享

微信扫一扫

对后端返回的时间进行升序的排序

拾杨梅记 2022-07-13 阅读 85

other.sort(function(a,b){
let startTime=a.time.replace(/\-/g, '/')
let endstTime=b.time.replace(/\-/g, '/')

return Date.parse(startTime) - Date.parse(endstTime);//时间正序
})





时间格式:[
{'time':'2018-9-10 0-0-0','first':'page'},
{'time':'2018-9-10 0-0-0','first':'page'},
{'time':'2018-9-10 0-0-0','first':'page'},
{'time':'2018-9-10 0-0-0','first':'page'}




]

举报

相关推荐

前端处理后端返回的时间

java对存放实体的list进行排序

0 条评论