2016-03-28 116 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)); 
相關問題