2017-05-03与03May2017之间的转化

function getEnglishDate(time) {
var date = new Date(time);
var monthArray=new Array
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
"Sep","Oct","Nov","Dec");
month=date.getMonth();
day=date.getDate();
if(day.toString().length == 1){
day="0"+day.toString();
}
return(day+""+ monthArray[month]+""+
date.getFullYear());
}


function getNormalDate(time) {
var date = new Date(time);
var monthArray=new Array
("01","02","03","04","05","06","07","08",
"09","10","11","12");
month=date.getMonth();
day=date.getDate();
if(day.toString().length == 1){
day="0"+day.toString();
}
return(date.getFullYear()+"-"+ monthArray[month]+"-"+day);
}

getEnglishDate(2017-05-03);

getNormalDate(03May2017);

 

posted @ 2017-05-03 13:32  EchoDuangDuang~  阅读(329)  评论(0编辑  收藏  举报