所以我爆炸了日期并在日期(日)中添加了一些数字,但是当我从月份中选择最后一个日期(例如:2019-07-31)时,我添加了数字(2)。它显示的是因为日期为33。
Example :
$a = "2019-07-31";
$b = DateTime("Y-m-d", $a);
$curr_month = $b->format("Y-m");
for($i=2;$i<3;$i++) {
$count[] = $i;
}
$data = [
[
'f_date' = $curr_month.$this->_calc($count[0])
]
];
function _calc($count) {
$a = "2019-07-31";
$b = DateTime("Y-m-d", $a);
$curr_month = $b->format("Y-m");
$curr_day = $b->format("d");
$calc = strval($curr_day + $count);
if($calc < 10) {
return "0".$calc;
}
else {
return $calc;
}
}
因此,当我运行代码时,我希望2019-07-31的结果成为2019-08-02。很抱歉,我的解释还不够。