How do I format a Microsoft JSON date?

后端 未结 30 3099
伪装坚强ぢ
伪装坚强ぢ 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 05:03

    Click here to check the Demo

    JavaScript/jQuery

    var = MyDate_String_Value = "/Date(1224043200000)/"
    var value = new Date
                (
                     parseInt(MyDate_String_Value.replace(/(^.*\()|([+-].*$)/g, ''))
                );
    var dat = value.getMonth() +
                             1 +
                           "/" +
               value.getDate() +
                           "/" +
           value.getFullYear();
    

    Result - "10/15/2008"

提交回复
热议问题