tags:

views:

32

answers:

3

Given a time, how can I find the time one month ago.

A: 

In php you can use strtotime("-1 month"). Check out the documentation here: http://ca3.php.net/strtotime

justinl
+1  A: 
strtotime( '-1 month', $timestamp );

http://php.net/manual/en/function.strtotime.php

Galen
A: 
<?php

$date = new DateTime("18-July-2008 16:30:30");
echo $date->format("d-m-Y H:i:s").'<br />';

date_sub($date, new DateInterval("P1M"));
echo '<br />'.$date->format("d-m-Y").' : 1 Month';

?> 
Kirill V. Lyadvinsky