PHP中如何给日期加上一个月/天
使用php的strtotime
实例:比如现在时间是“2017-07-06”,加一个月。
echo date("Y-m-d", strtotime("+1 months", strtotime("2017-07-06")));
<?php
echo(strtotime("now"));
echo(strtotime("3 October 2005"));
echo(strtotime("+5 hours"));
echo(strtotime("+1 week"));
echo(strtotime("+1 week 3 days 7 hours 5 seconds"));
echo(strtotime("next Monday"));
echo(strtotime("last Sunday"));
?>
print_r(date('Y-m-d H:i:s',strtotime("+1 month")));
$DaQianYueChu="2022-10-20";
$DaQianYueMo=date("Y-m-d",strtotime("$DaQianYueChu +1 month -1 day"));
//2022-09-21
无论从事什么行业,只要做好两件事就够了,一个是你的专业、一个是你的人品,专业决定了你的存在,人品决定了你的人脉,剩下的就是坚持,用善良專業和真诚赢取更多的信任。
评论已关闭