How to format all of my date fields?
How to format all of my date fields?
mmcnair80
Posts: 83Questions: 21Answers: 7
I have a bunch of dates that I would like to format. Currently, they are all DateTime I want them to be just the date in formatted as DDMMYYY.
How would I do this? I'm using Serverside processing and initializing my tables like this:
<script type="text/javascript" class="init">
$(document).ready(function () {
// Setup - add a text input to each footer cell
$('#DataTable tfoot th').each(function () {
var title = $(this).text();
$(this).html('<input type="text" placeholder="Search ' + title + '" />');
});
var table = $('#DataTable').DataTable({
"lengthMenu" : [[25, 50, 75, 100, 150], [25, 50, 75, 100, 150]],
"dom" : '<"top"Biflp<"clear">>rt<"bottom"ip<"clear">>',
"buttons" : [{
extend : 'collection',
text : 'Selection',
buttons : ['selectAll', 'selectNone']
}, {
extend : 'collection',
text : 'Export',
buttons : ['excel', 'csv', 'pdf']
}
],
"fixedHeader" : {
header : true,
footer : true
},
"select" : true,
"processing" : true,
"serverSide" : true,
"ajax" : {
"url" : "./ServerSide.php",
"type": "POST"
},
initComplete: function() {
var api = this.api();
// Apply the search
api.columns().every(function() {
var that = this;
$('input', this.footer()).on('keyup change', function() {
if (that.search() !== this.value) {
that
.search(this.value)
.draw();
}
});
});
}
});
});
</script>
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Never mind, I figured it out. I added a couple lines to my FilterSort.class.php file (a modified version of the ssp.class.php). I updated the function data_output to be this: