function OnSubmit() {

            var year = new Date().getFullYear();
            var month = new Date().getMonth() + 1; // 记得当前月是要+1的
            var dt = new Date().getDate();
            var today = year + "-" + month + "-" + dt;
            var reault = dateCompare($("#Dtp_PublicTime").val(), today)
            if (!reault) {
                alert("发布时间时间必须大于或等于当前时间");
                return false;
            }
        }

        //比较日期
        function dateCompare(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 lktime = new Date(arrs[0], arrs[1], arrs[2]);
            var lktimes = lktime.getTime();

            if (starttimes < lktimes) {
                return false;
            }
            else {
                return true;
            }

        }

 

分类:

技术点:

相关文章: