Something like below may do; however, IIRC, the time / date functions rely on the correct server time, leap years, and the EST - EDT time change (if observed).
<?php
$dbtime = date('Y-m-d', time());
list($year, $mon, $day) = sscanf($dbtime, '%4d-%2d-%2d');
$newt = mktime(0, 0, 0, $mon, $day, $year) + (3600 * 24 * 30);
echo "dbtime = " . $dbtime;
echo "<br />new time = " . date('Y-m-d', $newt);
?>It *may* also be easier to use a varchar or bigint to store the time in the database instead of using the TIMEDATE or similar db functions... that way, you'd start out with an int instead of a formatted string. HTH
|