Fecha
4 years ago in HTML
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
var d = new Date();
var hours = d.getHours() % 12;
hours = hours ? hours : 12;
var test = ("00" + d.getDate()).slice(-2) + " " + ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'][(d.getMonth() + 1)] + " " +
d.getFullYear() + " " +
("00" + hours).slice(-2) + ":" +
("00" + d.getMinutes()).slice(-2) + " " +
(d.getHours() >= 12 ? 'pm' : 'am');
document.getElementById("demo").innerHTML = test;
</script>
</body>
</html>