2011-03-07 24 views
1

下一個到期日期在我的PHP項目,我想找出失效日期(例如,今天是我加盟日期,那麼我的截止日期是下個月即有效期爲1個月)如何找到在Php

這是做什麼最好的方法。

+0

瞭解時,在什麼情況下?需要更多細節。 – 2011-03-07 10:08:24

+0

任何[「如何獲得下一個x日期」](http://stackoverflow.com/search?q= [php] + next + month)的副本。請使用搜索功能。現在有數百個類似的問題。 – Gordon 2011-03-07 10:08:29

回答

2

這個怎麼樣?

http://php.net/manual/en/function.strtotime.php

$date = date("Y-m-d");// current date 

$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day"); 
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 week"); 
$date = strtotime(date("Y-m-d", strtotime($date)) . " +2 week"); 
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month"); 
$date = strtotime(date("Y-m-d", strtotime($date)) . " +30 days")