我想将日期增加一个月,但是, 当前日期有效,但是我需要将日期增加一个月(动态)
我从下面的响应中尝试过
new OfflinePlugin({
cacheMaps: [
{
match: function (requestUrl) {
return new URL('/', location)
},
requestTypes: ['navigate']
}
]
})
如何在日期函数中添加$ regdate变量...?
答案 0 :(得分:1)
尝试一下
$regdate=$row2['created_date'];
$date = new DateTime($regdate);
$interval = new DateInterval('P1M');
$date->add($interval);
$onemonth = $date->format('Y-m-d');
答案 1 :(得分:1)
我认为,如果您在php语句之前从数据库中编辑了数据,那将是完美的:
MYSQL级别:
SELECT DATE_ADD( yourDate, INTERVAL 1 month ) from your table .
答案 2 :(得分:0)
尝试一下
'123-'
'1 - '
'66 -'
答案 3 :(得分:0)
尝试以下操作:
在给定日期增加了1个月
$date = $row2['created_date'];
$date = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " +1 month") );
echo $date;
您可以添加所需的时间段,如下所示:
Add day
$date = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " +1 day") );
Multiple days
$date = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " +15 days") );
Add week
$date = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " +1 week") );
Add month
$date = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " +1 month") );