开发者

How to find the next expiration date in Php

In my Php project, i want to find out the expiration date ( eg,today is my joining date then my expiry date is the next month ie validity开发者_运维百科 is 1 month)

What is the best way to do this.


How about this ?

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")


you will need to look at http://au.php.net/manual/en/function.date.php, look at the examples.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜