I have tried to access date stored in my db table and compare it with current date so that i can get the number of days but it shows this error
DateTime::__construct(): Failed to parse time string ([{"quit_date":null},{"quit_date":null}]) at position 0 ([): Unexpected character
This is the code that use in my controller
$quit_date = Information::select('quit_date')
->where('user_id','=',\Auth::user()->id)
->get();
$date = new Carbon($quit_date);
$now = Carbon::now();
$day = $date->diffInDays($now);
but if I set the $quit_date manually with the date for example "2019-04-25 00:00:00.000000", the code works fine and show the day different between the date, but when I use the Information::select to read the date from database, it shows error.
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2DzuhQH
via IFTTT
Selecting 1z0-1042 for my guidance proved worth every penny!
RépondreSupprimer