1190 0 0 0
Last Updated : 2025-04-28 21:56:29
To convert a mysql date to an ordinary date you can use the following snippet
//MYSQL timestamp to date
date("Y-m-d", strtotime($item->date)
{{ strftime("%d %b %Y",strtotime($user->created_at)) }}
In other situation, you will need to convert a timestamp to match and be inserted to a mysql , Here is a simple note and solution:
//Transform timestamp to a mysql date
$allowedDate = date('Y-m-d H:i:s', time()-$allowedMonths*30*24*60*60);
//Now you can use this with your model queries
$oldRecords = FeedvisitstatusModel::where('view_date', "<", $allowedDate)->delete();