Last active
April 13, 2022 03:15
-
-
Save dimaspante/1a777234fe5050383b54855c55371f08 to your computer and use it in GitHub Desktop.
Exibe a hora e data por extenso no campo id dt_inscricao
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mostrarDataHora(){ | |
var hoje = new Date(); | |
//https://stackoverflow.com/questions/24998624/day-name-from-date-in-js | |
var days = ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado']; | |
var mons = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; | |
var nome = days[hoje.getDay()]; | |
var data = nome + ', ' + ("0" + hoje.getDate()).slice(-2) + ' de ' + mons[hoje.getMonth()] + ' de ' + hoje.getFullYear(); | |
var hora = ("0" + hoje.getHours()).slice(-2) + ":" + ("0" + hoje.getMinutes()).slice(-2) + ":" + ("0" + hoje.getSeconds()).slice(-2); | |
document.getElementById("dt_inscricao").value = hora + ' - ' + data; | |
} | |
window.onload = function(){ | |
mostrarDataHora(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment