'Get day name from DB::raw date format in laravel
Here is my code
Attendance::select(DB::raw('DATE_FORMAT(date, "%D, %d %M %y") as date'))
->where('id', $objAttendance->id)
->first();
But it returns :
"date" => "19th, 19 March 22"
i need date like "Monday, 19 March 2022"
Thanks in advance.
Solution 1:[1]
By keep searching, I get it by adding %W :
Attendance::select(DB::raw('DATE_FORMAT(date, "%W, %d %M %y") as date'))
->where('id', $objAttendance->id)
->first();
Here is the link of answer : Laravel Query - Only the top amount for each day of the week
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Wahyu Kristianto |
