0

código atual

 return datatables()->of($query->get())
                        ->addColumn('action', function($data){
                            $button = '<button type="button" name="edit" id="'.$data->id.'" class="edit btn btn-primary btn-sm">Edit</button>';
                            $button .= '&nbsp;&nbsp;';
                            $button .= '<button type="button" name="delete" id="'.$data->id.'" class="delete btn btn-danger btn-sm">Delete</button>';
                            return $button;
                        })
                        ->rawColumns(['action'])
                        ->make(true);
            }

Tenho um campos vencimento_titulo sendo renderizado porém com o formato Y/m/d gostaria de d/m/Y.

2 Respostas 2

1
->editColumn('vencimento_titulo', function ($data) {
            return $data->vencimento_titulo->format('d/m/Y');
    })
0

Possivelmente a saída do seu date-time está vindo em formato textual.

Para resolver isso você pode usar strtotime(), que recebe um date-time textual e converte em unix date-time e a função date(), que permite a formatação de preferência.

Fica assim:

date('d-m-Y', strtotime(vencimento_titulo))

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .