[英]Want to calculate the end date from the start date given using CjuiDatePicker
我是CJUIDatePicker
框架的CJUIDatePicker
,我正在使用CJUIDatePicker
來獲取插入到表中的start_date。 我還有一個名為end_date的字段,我想從代碼中插入end_date,例如:
$this->end_date = $this->start_date + 2Months; // how to do this?
這取決於start_date
和end_date
的格式。 如果是UNIX時間戳記,那么最簡單的是:
$this->end_date = strtotime('+2 months', $this->start_date);
如果還有其他問題,答案取決於確切的答案。
經過更多的研究,我才能夠得到它。
$ currentDate = $ this-> start_date; //將start_date設置為變量
$ this-> end_date = date(“ Ymd”,strtotime('+ 4 year',strtotime($ currentDate))); // end_date現在是start_date加上4年
謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.