What can I do to configure columns to view all date fields on "DD-MM-YYYY" format?
What can I do to configure columns to view all date fields on "DD-MM-YYYY" format?
All my date fields appears as "YYYY-MM-DD" but I need to see them in the format "DD-MM-YYYY".
I search in the forum but only talks of filtering and BD saving data. I only need modify the views.
Y have all my fields in HTML as:
<div class="form-group col-sm-12">
<label for="terminado" class="col-sm-1 control-label">Terminado:</label>
<div class="col-sm-2"><input id="terminado" name="terminado" type="text" class="form-control campos_fecha" autocomplete="off">
</div>
[...]
And .js file as:
"ajax":{
"method":"POST",
"url": "listar.php"
},
"columns":[
{"data":"idproyecto", "bVisible": false },
{"data":"terminado"}
[...]
Can you help me?
Replies
One option is to use moment.js and use
columns.render
to change the format. For example:If you need to sort by the date you can add the datetime-moment plugin.
Kevin