how to change the date using the datatables

0

I have a datatable that has a date field.

I want to change this same field from 2012-05-01 00: 00: 00.000 to 2012-05-01.

Is it possible?

    
asked by anonymous 14.10.2015 / 16:42

1 answer

0

Yes it is possible.

You should use the render function of the datatables plugin.

link

Example:

{
    "data": "minha_data",
    "render": function (data) {
        var date = new Date(data);
        var dataFormatada = date.getDate() + '/' + date.getMonth() + '/' + date.getFullYear();
        return dataFormatada;
    }
}

This in the declaration of your columns.

I would advise using a date format plugin such as link

Edited

More information about Date in javascript link

    
14.10.2015 / 16:58