Reputation: 202
using this query
$orders = Order::has('get_ot_creater')
->with('seller')
->where('approve_date',"!=",NULL)
->pluck('approve_date')->toArray();
I am getting array of approve_date
with i want to remove time how i can get only dates?
my output is
0 => "2021-03-26 19:32:00"
1 => "2021-03-24 20:06:00"
3 => "2021-03-22 13:02:00"
26 => "2021-03-29 00:33:00"
42 => "2021-03-25 15:50:00"
i want only dates like 2021-03-25
Upvotes: 0
Views: 809
Reputation: 703
Map over the orders:
$orders = Order::has('get_ot_creater')
->with('seller')
->where('approve_date',"!=",NULL)
->pluck('approve_date'); // Note: toArray is removed
$orders = $orders->map(function ($order) {
return substr($order, 0, 10); // Return only the first ten characters.
});
Upvotes: 2