更新
我们有一个内部UI库,该库必须能够应对Microsoft的ASP.NET内置JSON格式(如/Date(msecs)/最初在此处询问)以及大多数JSON的日期格式(包括JSON.NET)的要求2014-06-22T00:00:00.0。另外,我们需要应对oldIE无法处理的任何其他问题(小数点后3位)。
我们首先检测我们正在使用哪种日期,将其解析为普通的JavaScript Date对象,然后将其格式化。
1)检测Microsoft日期格式
// Handling of Microsoft AJAX Dates, formatted like '/Date(01238329348239)/'
function looksLikeMSDate(s) {
    return /^\/Date\(/.test(s);
}
2)检测ISO日期格式
var isoDateRegex = /^(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(\.\d\d?\d?)?([\+-]\d\d:\d\d|Z)?$/;
function looksLikeIsoDate(s) {
    return isoDateRegex.test(s);
}
3)解析MS日期格式:
function parseMSDate(s) {
    // Jump forward past the /Date(, parseInt handles the rest
    return new Date(parseInt(s.substr(6)));
}
4)解析ISO日期格式。
我们至少有一种方法可以确保我们处理的是标准ISO日期或修改为始终具有3毫秒位置的ISO日期(请参见上文),因此代码因环境而异。
4a)解析标准的ISO日期格式,以解决oldIE的问题:
function parseIsoDate(s) {
    var m = isoDateRegex.exec(s);
    // Is this UTC, offset, or undefined? Treat undefined as UTC.
    if (m.length == 7 ||                // Just the y-m-dTh:m:s, no ms, no tz offset - assume UTC
        (m.length > 7 && (
            !m[7] ||                    // Array came back length 9 with undefined for 7 and 8
            m[7].charAt(0) != '.' ||    // ms portion, no tz offset, or no ms portion, Z
            !m[8] ||                    // ms portion, no tz offset
            m[8] == 'Z'))) {            // ms portion and Z
        // JavaScript's weirdo date handling expects just the months to be 0-based, as in 0-11, not 1-12 - the rest are as you expect in dates.
        var d = new Date(Date.UTC(m[1], m[2]-1, m[3], m[4], m[5], m[6]));
    } else {
        // local
        var d = new Date(m[1], m[2]-1, m[3], m[4], m[5], m[6]);
    }
    return d;
}
4b)使用固定的3毫秒小数位解析ISO格式-简单得多:
function parseIsoDate(s) {
    return new Date(s);
}
5)格式化:
function hasTime(d) {
    return !!(d.getUTCHours() || d.getUTCMinutes() || d.getUTCSeconds());
}
function zeroFill(n) {
    if ((n + '').length == 1)
        return '0' + n;
    return n;
}
function formatDate(d) {
    if (hasTime(d)) {
        var s = (d.getMonth() + 1) + '/' + d.getDate() + '/' + d.getFullYear();
        s += ' ' + d.getHours() + ':' + zeroFill(d.getMinutes()) + ':' + zeroFill(d.getSeconds());
    } else {
        var s = (d.getMonth() + 1) + '/' + d.getDate() + '/' + d.getFullYear();
    }
    return s;
}
6)绑在一起:
function parseDate(s) {
    var d;
    if (looksLikeMSDate(s))
        d = parseMSDate(s);
    else if (looksLikeIsoDate(s))
        d = parseIsoDate(s);
    else
        return null;
    return formatDate(d);
}
下面的旧答案对于将这种日期格式绑定到jQuery自己的JSON解析中很有用,这样您就可以获得Date对象而不是字符串,或者如果您仍然停留在jQuery <1.5以下。
旧答案
如果在ASP.NET MVC中使用jQuery 1.4的Ajax函数,则可以使用以下命令将所有DateTime属性转换为Date对象:
// Once
jQuery.parseJSON = function(d) {return eval('(' + d + ')');};
$.ajax({
    ...
    dataFilter: function(d) {
        return d.replace(/"\\\/(Date\(-?\d+\))\\\/"/g, 'new $1');
    },
    ...
});
在jQuery 1.5中,可以parseJSON通过使用Ajax调用中的converters选项来避免全局覆盖该方法。
http://api.jquery.com/jQuery.ajax/
不幸的是,您必须切换到较旧的评估路线才能在全球范围内就地解析日期-否则,您需要在解析后根据具体情况对它们进行转换。