js求两个日期时间差。精确到年月日到秒

  function bb() {
            var a = new Date(2013, 10, 28,00,00,00);
            var b = new Date(2013, 04, 01,00,00,00);
            a = a.valueOf();
            b = b.valueOf();
            var c = a - b;
            c = new Date(c);
            alert(c.getFullYear() - 1970 + '年' + (c.getMonth()) + '个月' + (c.getDate()-1) + '天' + (c.getHours()-8) + '个小时' + c.getMinutes() + '分钟' + c.getSeconds() + '秒');

你可能感兴趣的:(c#)