2016-03-28 115 views
-1

我想在当前日期添加6个月。我使用了以下日期格式。如何在当前日期添加+6个月

$current_time = date('Y-m-d'); 

我已经使用下面显示的这种方法,但发生错误。

'遇到的格式不正确的数值'。 并打印该值
[expiring_plan_date] => 1970-01-02

$data['PlanPayment']['expiring_plan_date'] = date 
              (
              "Y-m-d", 
              strtotime("+6 month", $current_time) 
              ); 

请帮助..

+0

'日期( “年月日”,的strtotime( “+ 6月”))删除逗号; '只需使用这个 – devpro

+0

谢谢..它完美的作品..我错误的采取错误的格式。 – Loveysh

回答

0

strtotime

$data['PlanPayment']['expiring_plan_date'] = date("Y-m-d", strtotime("+6 month $current_time)); 
相关问题