JS把格林威治时间转换为北京标准时间

function fermitTime(time){
var now = new Date(time);
var year = now.getFullYear();
var mon = now.getMonth()+1;
var date= now.getDate();
if(mon<10){
mon = '0'+mon;
};
if(date<10){
date = '0'+date;
}
var postDate = year+'-'+mon+'-'+date;
return postDate;
}



alert(fermitTime(‘格林威治时间字符串’));

 

posted @ 2018-05-31 20:41  温柔的风  阅读(2431)  评论(0编辑  收藏  举报