Jnananjan
Jnananjan

Reputation: 21

Increase date value of current time in php using yii framework

I am new in coding with php and using yii framework.

Can any one help me with my problem.I have to date field in my database,One is upload date another is review date.I have taken the current date as upload date. here is the code:

$model = new CvUpload;
$model->attributes=$_POST['CvUpload'];
$model->upload_date = new CDbExpression("NOW()");

Now i need to do is add 90days to the upload date and save the increase value to review date field..Can any one help me with code example.AS im very poor at coding.

Upvotes: 1

Views: 197

Answers (2)

Insane Skull
Insane Skull

Reputation: 9358

Try Using date() instead of NOW():

 $model=new CvUpload;
 $model->attributes=$_POST['CvUpload'];
 $model->upload_date = new CDbExpression("(date('D')+ 90)");

or this:

CDbExpression('DATE_ADD(NOW(), INTERVAL 90 DAYS)');

or this:

date('Y-m-d', strtotime(NOW() ' + 90 days'));

Upvotes: 1

chris---
chris---

Reputation: 1546

You could use the mysql expression $model->review_date = new CDbExpression('DATE_ADD(NOW(), INTERVAL 90 DAYS)');

Upvotes: 0

Related Questions