时间转时间戳:
var dateSel="2019-05-31 10:20"
Date.parse(dateSel);//这里默认会将毫秒数转为000
时间戳转时间:
myTime(nS) { //时间戳转时间
if (nS == "" || nS == null) {
var noday = "0";
return noday;
} else {
var mydate = new Date(parseInt(nS));
var year=mydate.getFullYear();
var month = mydate.getMonth() + 1; //返回月份,因为返回值是0开始,表示1月,所以做+1处理
var days = mydate.getDate();
var hours=mydate.getHours();
var minutes=mydate.getMinutes();
var seconds=mydate.getSeconds();
return year+"-"+month+"-"+days+" "+hours+":"+minutes
}
}