开发者

PHP Date Manipulations

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜