javascript date format datetime code example
Example 1: javascript data em portugues
function dataAtualFormatada(){
var data = new Date(),
dia = data.getDate().toString(),
diaF = (dia.length == 1) ? '0'+dia : dia,
mes = (data.getMonth()+1).toString(), //+1 pois no getMonth Janeiro começa com zero.
mesF = (mes.length == 1) ? '0'+mes : mes,
anoF = data.getFullYear();
return diaF+"/"+mesF+"/"+anoF;
}
Example 2: js datetime format
new Date().toISOString().slice(0, 16).replace("T", " ")