JS转换Fri Oct 31 18:00:00 UTC+0800 2008格式

    function Todate(num) { //Fri Oct 31 18:00:00 UTC+0800 2008
        num = num + "";
        var date = "";
        var month = new Array();
        month["Jan"] = 1; month["Feb"] = 2; month["Mar"] = 3; month["Apr"] = 4; month["May"] = 5; month["Jun"] = 6;
        month["Jul"] = 7; month["Aug"] = 8; month["Sep"] = 9; month["Oct"] = 10; month["Nov"] = 11; month["Dec"] = 12;
        var week = new Array();
        week["Mon"] = ""; week["Tue"] = ""; week["Wed"] = ""; week["Thu"] = ""; week["Fri"] = ""; week["Sat"] = ""; week["Sun"] = "";
        str = num.split(" ");
        date = str[5] + "-";
        date = date + month[str[1]] + "-" + str[2];
        return date;
    }

 

posted @ 2017-01-11 13:55  风儿_VIP  阅读(1256)  评论(0编辑  收藏  举报