How do I format a Microsoft JSON date?

后端 未结 30 3112
伪装坚强ぢ
伪装坚强ぢ 2020-11-21 04:48

I\'m taking my first crack at Ajax with jQuery. I\'m getting my data onto my page, but I\'m having some trouble with the JSON data that is returned for Date data types. Basi

30条回答
  •  半阙折子戏
    2020-11-21 04:53

    This may can also help you.

     function ToJavaScriptDate(value) { //To Parse Date from the Returned Parsed Date
            var pattern = /Date\(([^)]+)\)/;
            var results = pattern.exec(value);
            var dt = new Date(parseFloat(results[1]));
            return (dt.getMonth() + 1) + "/" + dt.getDate() + "/" + dt.getFullYear();
        }
    

提交回复
热议问题