Jul 22, 2020
0
Level 1
How do i display my English date as Nepali date on my datatables index?
So i have a datatable which displays the columns from the database. What i am trying is to display my date as the format selected in the setting page which can be either English or Nepali I am using carbon to format the dates and using setLocale but it is not working. Here is what i am doing
$datatable = Datatables($sales)
->addColumn('date', function ($sales) {
if($sales->date){
$date_format = Setting::where('meta_key', 'date_format')->get('meta_value')->pluck('meta_value')[0];
$date_locale = Setting::where('meta_key', 'calendar_type')->get('meta_value')->pluck('meta_value')[0];
Carbon::setLocale('ne');
return Carbon::parse($sales->date)->format($date_format);
}
})
Do i need to provide with a proper date format to support nepali date or is there any other way?
Please or to participate in this conversation.