Recent Topics

Dateformat in Datagrid



  • Hello,

    I am trying to change dateformat from y-m-d to m-d-y in package but not getting success. Can you tell me how to change dateformat in datagrid. I have tried in query also but not worked

      $this->addColumn([
            'index' => 'created_at',
            'label' => trans('marketplace::app.admin.sellers.created-at'),
            'type' => 'datetime',
            'sortable' => true,
            'searchable' => false,
            'filterable' => true
        ]);
    

    Regards
    Deepak Sharma



  • @dsharma said in Dateformat in Datagrid:

    $this->addColumn([
    'index' => 'created_at',
    'label' => trans('marketplace::app.admin.sellers.created-at'),
    'type' => 'datetime',
    'sortable' => true,
    'searchable' => false,
    'filterable' => true
    ]);
    you can use predefined method i.e "wrapper" for more customize
    eg :

    $this->addColumn([
    'index' => 'created_at',
    'label' => trans('marketplace::app.admin.sellers.created-at'),
    'type' => 'datetime',
    'sortable' => true,
    'searchable' => false,
    'filterable' => true,
    'wrapper' -> function ($data) {
    //all the value which is passed from the datagrid
    return date(m-d-y);
    //you can modified here like this
    }
    ]);



  • Thanks jyoti but i have already tried that it is not accepting data in closure function


Log in to reply