This topic is locked

calculating date in future

8/13/2007 12:22:51 AM
PHPRunner General questions
Allenh author

I know this should be easy, but I can't find any examples that I can get to work. I need to calculate x number of days between dateA and b.
I have three fields

dateA: date

daysbetween: int

dateb: date
dateA + daysbetween = dateb
I've tried...event, before record added,

$values["dateb"] = date("Y-m-d", strtotime("daysbetween"));
I've tried...

SELECT DATE_ADD('dateA', INTERVAL 'daysbetween' DAY);
I know that I'm missing dateb= but I don't know how to add it properly. Thanks in advance for your help.

J
Jane 8/13/2007

Al,
try to use this code:

$values["dateb"]= date("Y-m-d", strtotime($values["dateA"])+606024*$values["daysbetween"]);

Allenh author 8/13/2007

That fixed it.

Thank you very much very all the excellent support you provide.
Allen.