json date convert

function getDateTime(jsondate) {
var date = new Date(parseInt(jsondate.replace("/Date(", "").replace(")/", ""), 10));
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var hh = date.getHours();
var mm = date.getMinutes();
var ss = date.getSeconds();
return year + "-" + month + "-" + day + " " + hh + ":" + mm + ":" + ss;
}

getDateTime("\/Date(1385827200000+0800)\/")

posted on 2014-09-14 11:38  refactor  阅读(269)  评论(1编辑  收藏  举报

导航