gpt4 book ai didi

php - 将日期增加一个月

转载 作者:IT老高 更新时间:2023-10-28 11:52:36 25 4
gpt4 key购买 nike

假设我有一个格式如下的日期:2010-12-11(年-周一-日)

使用 PHP,我想将日期增加一个月,并且如果需要,我希望年份自动增加(即从 2012 年 12 月增加到 2013 年 1 月)。

问候。

最佳答案

$time = strtotime("2010.12.11");
$final = date("Y-m-d", strtotime("+1 month", $time));

// Finally you will have the date you're looking for.

关于php - 将日期增加一个月,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2870295/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com