function compareDate(startDate, endDate) { var arr = startDate.split("-"); var starttime = new Date(arr[0], arr[1], arr[2]); var starttimes = starttime.getTime(); var arrs = endDate.split("-"); var jstimes = new Date(arrs[0], arrs[1], arrs[2]); var jstimes = jstimes.getTime(); if (starttimes > jstimes) { return false; } else return true; }