产假计算器

-----------------index.html----------------------------------------

 <head>

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>日期计算</title>
</head>
        <p>日期计算</p>
        <form method="POST" action="date.php">
        年:<input type="text" name="year" maxlength="30" size="30"></br></br>
月:<input type="text" name="month" maxlength="30" size="30"></br></br>
日:<input type="text" name="date" maxlength="30" size="30"></br></br>
        <input type="submit" value="计算">

        </form>


-----------------------date.php----------------------------------------------

<html>  
<head>  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
</head>
    <body>


      <?php
           $year = $_POST['year'];  
           $month = $_POST['month'];  
           $date = $_POST['date'];
 


          $begin = "$year-$month-$date";
          echo "开始(放假)日期: $begin <br><br>";
          $begintime = strtotime($begin);
          $endtime = $begintime + (178 * 24 * 3600);   #目前产检天数标准为178天
          $end = date("Y-m-d", $endtime);
          echo "结束(上班)日期: $end <br><br>";


      ?>
  
    </body>  
</html>

猜你喜欢

转载自blog.csdn.net/cookie_1030/article/details/78457895