jquery data format code example
Example 1: jquery date format
$.date = function(dateObject) {
var d = new Date(dateObject);
var day = d.getDate();
var month = d.getMonth() + 1;
var year = d.getFullYear();
if (day < 10) {
day = "0" + day;
}
if (month < 10) {
month = "0" + month;
}
var date = day + "/" + month + "/" + year;
return date;
};
Example 2: formatar data com jquery
var data = '2016-12-08 00:00:00.0';
var dataFormatada = data.replace(/(\d*)-(\d*)-(\d*).*/, '$1-$2-$3');
console.log(dataFormatada);