开发者

PHP Date Manipulations

开发者 https://www.devze.com 2023-01-02 00:25 出处:网络
I need to get previous 30 days from a specific date which is available from database(eg: 2010-05-23 12:36:29).I am try it by using

I need to get previous 30 days from a specific date which is available from database(eg: 2010-05-23 12:36:29).I am try it by using

date('d', strtotime("-30 days"))

Which is getting the currect answer what i 开发者_开发知识库looking for but it is not help me to enter date from database.Please help me to solve the issue.


Step by step:

$db_string =           "2010-05-23 12:36:26";
$db_timestamp =        strtotime($db_string);
$db_timestamp_30days = strtotime("-30 days", $db_timestamp);

$readable_date = date("d", $db_timestamp_30days);
0

精彩评论

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