datatables field format

-2

Well, I needed a hint: how do I get the render from the datatables to show me just the date of the line below, and to format the next value for the €?

   "mrender": function ( data, type, row ) {
                                        //The date value was 2011/04/25, now it's reversed.
                                        //Wed Sep 10 2014 00:00:00 GMT+0700 (SE Asia Standard Time)
                                        var fullDate = row[4].toString();
                                        date = fullDate.substring(8, 10);
                                        month = fullDate.substring(4, 7);
                                        year =fullDate.substring(11, 15);
                                        fixDate = date.concat(" "+month+" "+year);
                                        return fixDate;
                                    },
                                    "targets": 6,
                }

2016-04-29 00: 00: 00,000

45.4400

    
asked by anonymous 06.01.2016 / 17:17

1 answer

1

For dates, I would use Moment.js :

var fullDate = moment(row[4].toString()).format('YYYY-MM-DD hh:mm:ss');

For money, Numeral.js :

var grana = numeral(45,4400).format('0.0')
    
06.01.2016 / 17:48