This topic is locked

Adding one month to date

2/6/2008 7:12:48 PM
PHPRunner General questions
J
jamesberry12 author

I have a table called clients.

In that table I have a field called Dischargewhich is a date field and another called 30_day

I need the 30_day field to equal the Dischargedate plus 1 month

The Dischargedate will not be now()

Suggestions?

J
Jane 2/7/2008

Hi,
use Before record added/Before record updated event on the Events tab for this purpose.

Here is a sample:

$date1 = strtotime($values["Discharge"]);

$values["30_day"] = date("Y-m-d",mktime(0, 0, 0, date("m",$date1)+1, date("d",$date1), date("Y",$date1)));