开发者

How to find the next expiration date in Php

开发者 https://www.devze.com 2023-02-15 18:36 出处:网络
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 monthie validity开发者_运维百科 is 1 month)

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

精彩评论

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