This topic is locked

Help with sum of dates

3/29/2012 2:35:51 PM
PHPRunner General questions
B
bilboss author

I have a field 'date' field and 'days'

I want to add a new record I enter a date and you add up the days that contains the field days.
example

'date field' = 2012/03/29

'field days' = 4

'result field' = 2012/04/02
there is compliance date field 'status' is changed to 'completed'
hopefully you understand.
thank you very much

P
procheck 3/29/2012

This might work for you.
$date = date("Y-m-d");// current date
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day");

$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 week");

$date = strtotime(date("Y-m-d", strtotime($date)) . " +2 week");

$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");

$date = strtotime(date("Y-m-d", strtotime($date)) . " +30 days");

B
bilboss author 3/29/2012

to keep a record

the field 'days' have to increase to the field 'date' day and save the result in another field

this code where in I have to enter it

?

B
bilboss author 3/30/2012

help?

D
danaci 3/31/2012

$date = date("Y-m-d");// current date

echo $date."
";

$date = date("Y-m-d",strtotime(date("Y-m-d", strtotime($date)) . " +1 day"));

echo $date."
";

$date = date("Y-m-d",strtotime(date("Y-m-d", strtotime($date)). " +1 week"));

echo $date."
";

$date = date("Y-m-d",strtotime(date("Y-m-d", strtotime($date)). " +2 week"));

echo $date."
";

$date = date("Y-m-d",strtotime(date("Y-m-d", strtotime($date)) . " +1 month"));

echo $date."
";

$date = date("Y-m-d",strtotime(date("Y-m-d", strtotime($date)). " +30 days"));

echo $date."
";