Get the current date and time as mktime in PHP

advertisements

I have a problem with find the current date from past mktime. In PHP I find the current date using date("j");. Here I need, suppose my date was in the past year like mktime(0, 0, 0, 2, 1, 2008), then here how can I find the current date of this particular past month.


Either as @octern's solution, or you can do

$day = date('j', strtotime("-2 months"));

or

$day = date('j', strtotime('-30 days'));

depending on your need.

You may also want to refer to strtotime() manual.