0

I have a frontend app and I have a column with date and time and I would like to format it. The npm module used for the table is datatables.net-dt

Here is the code:

$(document).ready(function() {
               var table = $('#example').DataTable({
                    responsive:true,
                    data:res.mesaje,
                    buttons:true,
                    destroy:true,
                    columns: [
                        
                        {data:'datetime'},
                       
                        {defaultContent:'<button id="buton123">Download</button>'}
                        
                    ]
                })

I tried with moment.js using the function of moment formatting after {data:moment...etc.. but it shows nothing in the date time column. The datetime format that i get from the API is 202011100707 and I would like to format it to 2020/11/11 10:10 something like that. Please help

FObersteiner
  • 16,957
  • 5
  • 24
  • 56
RamonS
  • 11
  • 1
  • One approach is shown [here](https://stackoverflow.com/a/62456463/12567365). There are various other answers/approaches [in these questions](https://www.google.com/search?q=datatables+format+date+column+site%3Astackoverflow.com). If none of those work for you, can you provide a [mre]? – andrewJames Nov 15 '21 at 13:14

0 Answers0