我如何通过添加几个月来显示日期 [英] how do i display a date by adding a few months to it

查看:51
本文介绍了我如何通过添加几个月来显示日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个日期 10/10/2009 并且我想添加 strtotime(+# 月) 来显示到期日期?

if i have a date 10/10/2009 and i wanted to add strtotime(+# months) to display an expiration date?

10/10/2009 是客户推算的开始日期,+# 个月是为特定产品添加多少个月以显示到期日期.

the 10/10/2009 is a start date which is imputed by the customer and the +# months is how ever many months were added for a specific product to display the expiration date.

我如何将两者相加以找到到期日期?

how would i add the two to find the expiration date?

推荐答案

本教程最近帮我解决了这类问题.

This tutorial helped me with exactly this kind of problem recently.

$date = "2009-10-10";
$newdate = strtotime ("$date +3 month") ;
$newdate = date ( 'Y-m-j' , $newdate );

echo $newdate;

这篇关于我如何通过添加几个月来显示日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆