js 常用函数
format(date,partten) {
if (partten == null || partten == '') {
partten = 'y-m-d';
}
var y = date.getYear();
var m = date.getMonth() + 1;
var d = date.getDate();
var r = partten.replace(/y+/gi, y);
r = r.replace(/m+/gi, (m < 10 ? "0" : "") + m);
r = r.replace(/d+/gi, (d < 10 ? "0" : "") + d);
return r;
}
日期兼容ios
let date = new Date(Date.parse(strTime.replace(/-/g, "/"))); //转换成Data();