zoukankan      html  css  js  c++  java
  • js计算日期天数差-2013-9-26

    function daymath(sdate, edate) {
                var startdate = sdate;
                var enddate = edate;
                if (startdate == "" || enddate == "") {
                    return;
                }
                startdate = startdate.replace(/-/g, "/");
                enddate = enddate.replace(/-/g, "/");
                var hour = (new Date(enddate) - new Date(startdate)) / 1000 / 60 / 60 / 24;
                var inthour = parseInt(hour);
                if (inthour <= 0) {
                    $("#day").val("");
                    return;
                }
                var h = hour.toString();
                var hflot = 0;
                var day = 0;
                if (h.indexOf('.') > 0) {
                    hflot = parseInt(h.substring(h.indexOf('.') + 1, (h.indexOf('.') + 2)));
                }
                if (hflot > 5) {
                    day = inthour + 1;
                }
                if (hflot > 0 && hflot < 5) {
                    day = inthour + 0.5;
                }
                else {
                    day = inthour;
                }
                return day;
            }

  • 相关阅读:
    MySQL "show users"
    MySQL
    A MySQL 'create table' syntax example
    MySQL backup
    MySQL show status
    Tomcat, pathinfo, and servlets
    Servlet forward example
    Servlet redirect example
    Java servlet example
    How to forward from one JSP to another JSP
  • 原文地址:https://www.cnblogs.com/suncoolcat/p/3341824.html
Copyright © 2011-2022 走看看