Converting to a human readable format and sorting the date time values in a DataTable

Converting to a human readable format and sorting the date time values in a DataTable

rileystlrileystl Posts: 7Questions: 2Answers: 0
edited January 2015 in Free community support

Update:
I was able to solve the problem myself.

I have HTML markup for a table as follows:
<thead>
<tr>
<th>Name</th>
<th width="20%">Count</th>
<th>Created</th>
</tr>
</thead>
<tbody>
<tr>
<td>Pam Shriver</td>
<td>Eu Foundation</td>
<td>2015-1-8-7:52:20</td>
</tr>
<tr>
<td>Melinda Dolittle</td>
<td>Sit Amet Inc.</td>
<td>2015-1-8-7:47:43</td>
</tr>
<tr>
<td>Tom Haverford</td>
<td>Tempus Lorem LLC</td>
<td>2015-1-8-7:38:36</td>
</tr>
<tr>
<td>Cyrus Haney</td>
<td>Phasellus Corp.</td>
<td>2015-1-8-7:53:10</td>
</tr>
<tr>
<td>Melinda Salas</td>
<td>Molestie Sed Id Limited</td>
<td>2015-1-8-7:37:34</td>
</tr>
<tr>
<td>Rebecca Cline</td>
<td>Eget Dictum Placerat Limited</td>
<td>2015-1-8-7:36:32</td>
</tr>

</tbody>

In my page i reference the required libraries as follows:

<script type="text/javascript" language="javascript" src="datetime-moment.js"> </script


My goal is to use moment.js to convert my "human-unfriendly format YYYY/MM/DD-hh:mm:ss or YYYY-MM-DD hh:mm:ss" to something like "DD/MM/YYYY HH:mm:ss or dddd, MMMM Do, YYYY (I prefer this)"and your datetime sorting plugin to sort the resulting converted datetime values to be displayed in my HTML table.

My attempt at solve my problem was to write the following code:

$(document).ready( function () {
alert("Loaded");
"mData": "Created", "sTitle": "Created", "sWidth": "20%", "bSortable": true,
"mRender": function (data, type, row) {
return moment(data).format('DD/MM/YYYY HH:mm:ss');
}

} );

But this is not doing anything. Can you shed light on this problem, and tell me what should be the corrected code to accomplish my goal?
I am sorry if the HTML markup is not displayed correctly.

This discussion has been closed.