php增加x天的日期/连接/管理休息日和周末

php增加x天的日期/连接/管理休息日和周末,php,javascript,date,increment,weekend,Php,Javascript,Date,Increment,Weekend,我想做一个简单的加法, 只是为了能如此准确地显示一些日期 我做过类似的事情: while($row = mysql_fetch_assoc($qry)): echo $req="INSERT INTO `agenda` SET `code_s`= '".$row['code_s']."', `titre` ='".$row['titre']."', `action` ='".$row['action']."', `libelle`='".$r

我想做一个简单的加法, 只是为了能如此准确地显示一些日期

我做过类似的事情:

 while($row = mysql_fetch_assoc($qry)): 

   echo  $req="INSERT INTO `agenda` SET
     `code_s`= '".$row['code_s']."',
     `titre` ='".$row['titre']."',
     `action` ='".$row['action']."',
     `libelle`='".$row['libelle']."',
      `date_action`='".date('Y-m-d',strtotime('+"'.$row['jour'].'" days'))."',
      `qualite`='".$da['qualite']."',
      `n_doss`='".mysql_real_escape_string($_GET['n_doss'])."',
      `code_client`='".$creance['code_client']."'<br>";
      endwhile;     };
我尝试的是显示var$行['jour']中包含的天数的递增日期,但实际上它只显示给我1970-01-01,所以我不理解为什么,因为所有var在该var中都有一个正数

此外,我还有一个javascript函数:

就像这样:

<script type="text/javascript">
    function getdate2() {
        var items = new Array();
        var itemCount = document.getElementsByClassName("datepicker hasDatepicker");

        for (var i = 0; i < itemCount.length; i++) {
            items[i] = document.getElementById("date" + (i + 1)).value;
        }



        for (var i = 0; i < itemCount.length; i++) {
            items[i] = document.getElementById("date" + (i + 1)).value;
            var itemDtParts = items[i].split("-");
            var itemDt = new Date(itemDtParts[2], itemDtParts[1] - 1, itemDtParts[0]);
        <?php $sql="SELECT * FROM `societe` WHERE `id`=1"; $result=mysql_query($sql) or die; $data=mysql_fetch_assoc($result);?><?php if($data['samedi']==0) {?>
            if (itemDt.getDay() == 6) {

                itemCount[i].value = (itemDt.getDate() < 9 ? "0" : "")+ (itemDt.getDate()+2)+ "-" + (itemDt.getMonth() < 9 ? "0" : "") + (itemDt.getMonth() + 1) + "-" + itemDt.getFullYear();


            }
            <?php } ?>
            if (itemDt.getDay() == 0) {

               itemCount[i].value = (itemDt.getDate() < 9 ? "0" : "")+ (itemDt.getDate()+1)+ "-" + (itemDt.getMonth() < 9 ? "0" : "") + (itemDt.getMonth() + 1) + "-" + itemDt.getFullYear();


            }

        }
       return items;
       }
</script>

函数getdate2(){
var items=新数组();
var itemCount=document.getElementsByClassName(“日期选择器hasDatepicker”);
对于(var i=0;i
实际上,如果一天是星期日或星期六,此函数仅递增日期,它取决于此行数据库中的参数设置:

<?php $sql="SELECT * FROM `societe` WHERE `id`=1"; $result=mysql_query($sql) or die; $data=mysql_fetch_assoc($result);?><?php if($data['samedi']==0) {?>
                if (itemDt.getDay() == 6) {

                    itemCount[i].value = (itemDt.getDate() < 9 ? "0" : "")+ (itemDt.getDate()+2)+ "-" + (itemDt.getMonth() < 9 ? "0" : "") + (itemDt.getMonth() + 1) + "-" + itemDt.getFullYear();


                } ?>

if(itemDt.getDay()==6){
itemCount[i]。值=(itemDt.getDate()<9?“0”:“”)+(itemDt.getDate()+2)+“-”+(itemDt.getMonth()<9?“0”:“”)+(itemDt.getMonth()+1)+“-”+itemDt.getFullYear();
} ?>
因为有时候有些公司会在星期六上班

我想知道如何在插入数据库之前在新日期应用此函数

有没有一种方法可以将javascript函数应用于php中的无对象项

受到我最大的尊重

亲切的问候


SP.

请尝试以下问题的php部分:

`date_action` = '". date('Y-m-d', strtotime(date("Y-m-d"). "+".$row['jour']."days"))."'
编辑:


)解析错误:语法错误,意外的T_封装的_和_空格,需要T_字符串或T_变量或T_NUM_字符串。感谢您的回答,它可以正常工作。您知道如何应用javascript函数吗?亲切的问候。SPnp,试图理解你的js问题:)…你说php中的
无对象是什么意思?好的,让我猜猜,你想在DB中插入
itemCount[i]。value
items
?是的,先生,没错,输入中没有对象实际上是无的
`date_action` = '". date('Y-m-d', strtotime(date("Y-m-d"). "+".$row['jour']."days"))."'
 `date_action` = '". date('Y-m-d', strtotime(date("Y-m-d"). "+".$row['jour']."days"))."'