var getFormat = function (data){
var date =new Date(data) ;
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
month = month<10?'0' + month:month;
day = day<10?'0' + day:day;
hours = hours<10?'0' + hours:hours;
minutes = minutes<10?'0' + minutes:minutes;
seconds = seconds<10?'0' + seconds:seconds;
var str = year + '-' + month + '-' + day ;
return str;
js时间格式化,按照年-月-日的格式
最新推荐文章于 2024-05-29 10:03:20 发布