Forum Moderators: coopster
Depending on your database you may well be able to do some/all of the arithmetic within the databse.
I use this code to get the date/time and insert it.
$date = date("m/d/y");
$time = date("H:i");
If what I am doing is ok how would i then pull it and format it so i can use with the following to add 4 months onto the month (I know how to get data from a table and everything, just not sure how to use it with mktime)?
$next = mktime(0,0,0,date("m")+4,date("d"),date("Y"));
thanx!
For adding any amount of time to your timestamp I find strtotime [uk2.php.net] the easiest way. As you can say -> strtotime(+1 month).
$last = $row1[Task_Date];
$next = explode("/",$last);
$future = strftime("%m/%d/%y",mktime(0,0,0,$next[1]+$row[Type_Months],$next[0],$next[2]));
It takes the date from the table ad adds the amount of months listed in the $row[Type_Months] field.