I believe the existing answers are deprecated due to updates to DataTables. HTML5 supports attributes that DataTables can use to easily sort columns. Specifically the data-sort attribute. (See https://datatables.net/examples/advanced_init/html5-data-attributes.html)
I can easily sort tables like so:
<table>
<thead>
<tr>
<td>Name</td>
<td>Age</td>
</tr>
</thead>
<tbody>
<tr>
<td>John Doe</td>
<td data-sort="37">2/1/78 (37 years old)</td>
</tr>
<tr>
<td>Jane Doe</td>
<td data-sort="35">12/1/80 (35 years old)</td>
</tr>
</tbody>
</table>
It doesn’t matter that the ‘Age’ column contains numbers, symbols, and letters, DataTables will sort using the ‘data-sort’ attribute.