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.
精彩评论