我确实用过
var elems = $("#D li").toArray();
elems.sort(function(a, b) {
var adate = new Date($(a).find('div.dateDiv').text());
var bdate = new Date($(b).find('div.dateDiv').text());
return adate > bdate ? -1 : 1;
});
$("#D").html(elems);
<div id="D">
<li>1<div class="dateDiv">2012-04-15 10:25:45</div><div>df</div></li>
<li>2 <div class="dateDiv">2012-04-10 19:41:08</div><div>df</div></li>
<li> 3 <div class="dateDiv">2012-04-20 07:00:10</div><div>ab</div></li>
<li>4 <div class="dateDiv">2012-04-12 16:45:50</div><div>a</div></li>
<li>1<div class="dateDiv">2012-04-15 10:25:45</div></li>
<li>2 <div class="dateDiv">2012-04-10 19:41:08</div></li>
<li> 3 <div class="dateDiv">2012-04-20 07:00:10</div></li>
<li>4 <div class="dateDiv">2012-04-12 16:45:50</div></li>
<li>1<div class="dateDiv">2012-04-15 10:25:45</div></li>
<li>2 <div class="dateDiv">2012-04-10 19:41:08</div></li>
<li> 3 <div class="dateDiv">2012-04-20 07:00:10</div></li>
<li>4 <div class="dateDiv">2012-04-12 16:45:50</div></li>
<li>1<div class="dateDiv">2012-04-15 10:25:45</div></li>
<li>2 <div class="dateDiv">2012-04-10 19:41:08</div></li>
<li> 3 <div class="dateDiv">2012-04-20 07:00:10</div></li>
<li>4 <div class="dateDiv">2012-04-12 16:45:50</div></li>
</div>
我尝试了很多次 Firefox 浏览器或 IE 或 safari 的一些问题
它仅适用于 opera 和 chrome ,
传递给 new Date() 的正确跨浏览器日期格式是什么?