I have scrit which makes revision date from current date to 2 or x years later. What I need is to create script based on date which passed 2 days over. Let’s say I need to make input record in mysql db for job that were done some days ago an put that date in table and calculate revision date from that date two or x years later. Does someone have an idea how to do that?
Part of my script:
$formDatum = mysql_real_escape_string($_POST['formDatum']);
$date = new DateTime();
switch ($formUsluga)
{
case '1':
$date -> modify("+2 year");
$formRev=$date->format("Y-m-d H:i");
break;
case '2':
date_add($date, new DateInterval("P2Y"));
$formRev=$date->format("Y-m-d H:i:s");
break;
}
Do you mean that you want to add 2 years to a date?
I believe you could do it like this:
EDIT:
Right… I didn’t see that you had that part already. So you want to subtract the days that have past and then add the 2 years?