I tried this ,
$date = date('D, M dS Y g:i a', strtotime('2018-03-01 11:54:33'));
echo $date; // will print Thu, Mar 01st 2018 11:54 am
It worked , but I need same in search function ,
$table->where("main.no", "like", "%$searchfield%")
->orWhere("date('D, M dS Y g:i a', strtotime('timestamp'))", "like", "%searchfield%")
Here , if i search fri in searchfield input box , its showing error as ,
Column not found: 1054 Unknown column 'Thu, Jan 01st 1970 5:30 am' in 'where clause'
I think its trying to convert "fri" to date or something like that.
strtotimeis not a MySQL function, so cannot be used in the WHERE clause like that.dateexists in MySQL, but you're calling it with the PHP definition, not the MySQL definition, so it's going to be very confused.$table->where(function($query) use ($searchfield) { $query->where("main.no", "like", "%$searchfield%") ->orWhere(DB::raw("DATE_FORMAT(main.timestamp, '%a, %b %D %Y %h:%i %p')"), "like", "%$searchfield%"); });