Can I get help with the formatting date code for render.moment()

Can I get help with the formatting date code for render.moment()

fcampbellfcampbell Posts: 3Questions: 2Answers: 0

I am getting an "Invalid date" message when I try to use $.fn.dataTable.render.moment() in a sortable table.
$.fn.dataTable.render.datetime() does not sort correctly.

Code:
$.fn.dataTable.render.moment('MMM dd YYYY hh:mma', 'Do MMM YYYY')

Actual Data looks like this:
Aug 16 2023 12:00AM

Also need the formatting for this style:
2023-08-16 00:00:00.000

Any help would be appreciated!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    I think it is very close, its just that the a at the end needs to be A. See the Moment docs here.

    For the other one, .SSS is what you need at the end of the string.

    Allan

Sign In or Register to comment.