Reputation: 867
I am working in yii framework. i am getting current date in php (Yii framework) by-
$date =new CDbExpression('NOW()');
Its giving date in format-"2013-04-27 12:49:27". I want to find date after one year. So how to find date in this format after one year or certain period in php?
Upvotes: 1
Views: 889
Reputation: 11493
Or try this
$date = new CDbExpression('NOW() + INSTANCE 1 YEAR');
Upvotes: 0
Reputation: 21
You can use alternate which look like this:
$date =new CDbExpression('NOW()');
$NextYear = date('Y-m-d H:i:s',strtotime($date)) . " + 365 day"));
If you want more specific you can try:
$date =new CDbExpression('NOW()');
$NextYearDate=date('Y-m-d',strtotime('+1 year',$date));
Upvotes: 1