0

I'm using Datatables and one of my column is a timestamp, how can I convert it to have a date into date format (YYYYmmJJ or JJmmYYYYY)? enter image description here

I tried to add those lines :

columnDefs: [ {
  targets: 2,
  render: $.fn.dataTable.render.moment( 'YYYY/MM/DD', 'Do MMM YY', 'fr' )
} ]

but got this error:

Uncaught TypeError: $.fn.dataTable.render.moment is not a function

Maybe my timestamp is in the wrong format (ms).

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
userHG
  • 567
  • 4
  • 29
  • Does this answer your question? [Function to convert timestamp to human date in javascript](https://stackoverflow.com/questions/19485353/function-to-convert-timestamp-to-human-date-in-javascript) – Heretic Monkey Aug 24 '20 at 14:56
  • See https://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date for more options when formatting a `Date` object. – Heretic Monkey Aug 24 '20 at 14:57
  • 1
    Did you include moment.js in page? That error is telling you there is no `renderer.moment` – charlietfl Aug 24 '20 at 15:13

0 Answers0