Eu preciso mostrar a data no formato: 25 Dec 2011 12:35
Mas não tô conseguindo 2 coisas:
- colocar o mês certo (pq janeiro é 0), sem usar uma variavel e incrementar. tem como? pq qnd eu tento incrementar direto nesse out, dá 51 SEMPRE
- colocar o mês como string (jan dec, etc) - Preciso usar um switch pra isso? Q solução feia
Podem ajudar aqui?
Minha saída atual é 27 5 2017 17:24
<!DOCTYPE html>
<html>
<head>
<title>Testes</title>
<style>p {font: 14px normal arial, verdana, helvetica;}</style>
<script>
function telltime() {
//25 Dec 2011 12:35
var out = "";
var now = new Date();
out += now.getDate() + ' ' + now.getMonth() + ' ' + now.getFullYear() + ' ' + now.getHours() + ':' + now.getMinutes();
document.getElementById('div1').innerHTML = out;
}
</script>
</head>
<body>
<p>The Current Date and Time are:</p><br>
<div id="div1"></div>
<script>
telltime();
</script>
<br>
<input type="button" onclick="location.reload()" value="Refresh" />
</body>
</html>