php - date_add() expects parameter 1 to be DateTime, string given -


i trying fetch current date , add 7 calculate date of weekly installments project. while doing encountered problem:-

date_add() expects parameter 1 datetime, string given

the line causing me error

$loan->nextpremiumdate=date_add(date("y-m-d h:i:sa"),date_interval_create_from_date_string("1 days")); 

i using laravel framework. , nextpremiumdate column in loan table.

in model table declare want "nextpremiumdate" managed date:

public class loan extends model {        protected $dates = [ "nextpremiumdate" ]; } 

then laravel return field carbon date , can do:

$loan->nextpremiumdate = $loan->nextpremiumdate->adddays(7); 

you can refer laravel docs or carbon docs more details.


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -