各形式の「日付」要素を比較し、「時間」要素を除外していることを確認します。次に、両方の日付をミリ秒に変換して、単純に値を比較します。このようなことができます。日付が等しい場合は 0 を返し、最初の日付が 2 番目よりも小さい場合は -1 を返し、それ以外の場合は 1 を返します。
Javascript
function compareDates(milliSeconds, dateString) {
var year,
month,
day,
tempDate1,
tempDate2,
parts;
tempDate1 = new Date(milliSeconds);
year = tempDate1.getFullYear();
month = tempDate1.getDate();
day = tempDate1.getDay();
tempDate1 = new Date(year, month, day).getTime();
parts = dateString.split("/");
tempDate2 = new Date(parts[0], parts[1] - 1, parts[2]).getTime();
if (tempDate1 === tempDate2) {
return 0;
}
if (tempDate1 < tempDate2) {
return -1;
}
return 1;
}
var format1 = 1381308375118,
format2 = "2013/08/26";
console.log(compareDates(format1, format2));
jsfiddleについて