jsの中の時間の比較


/**      **/
            function compareDate(strDate1,strDate2)
            {
                var date1 = new Date(strDate1.replace(/\-/g, "\/"));
                var date2 = new Date(strDate2.replace(/\-/g, "\/"));
                return date1-date2;
            }
           
            /**    **/
            function doCompare(){
                var strDate1 = document.getElementById("strDate1").value;
                var strDate2 = document.getElementById("strDate2").value;
                var result = compareDate(strDate1,strDate2);
                if ( result>0 ) {
                    alert("strDate1  strDate2");
                }else if( result<0 ){
                    alert("strDate1  strDate2");
                }else if ( result==0 ){
                    alert("strDate1  strDate2");
                }
            }