How to get a future date in php?

Issue:
I would love to insert a 5 weeks date from appointment date, both field are custom fields in custom modules. I have been trying the following code with a before_save logic hooks, but it does not work. It does not save the record.
Could you point out where I am wrong?


:dry:

save() ??

Urh…I tried to add

EITHER
$date->save();
OR
$focus->next_follow_up_date_c->save();

It still does not save the whole record at all

are you breaking into the if statement?

I am sorry, what do you mean by that?

I think you have to turn your date back into the original format.

  1. you take the date and format it and add 35 days
  2. then you take that value and make the new date equal that

the new date is formatted differently than the old date - maybe date fields need that original date format. Try just making the new date equal thew old date without any formatting changes.

Thank you, I got rid of the format(), and if I do no modify(), it will be successfully passed to new field.
BUT it does not seem to recognize the modify() function, and it simply did not save it. I cannot add 35 days to it.