getDate() Returns the day of the month (from 1-31)
getFullYear() Returns the year (four digits)
getMonth() Returns the month (from 0-11)
Código HTML:
Ver original<!DOCTYPE html>
<p id="demo">Click the button to display dd.mm.yyyy.
</p>
function myFunction()
{
var d = new Date();
var x = document.getElementById("demo");
var mes=d.getMonth()+1;
x.innerHTML=d.getDate()+"."+mes+"."+d.getFullYear();
}
Muy complicado no era!!!!