DEV Community

Cover image for Today date using Javascript
Carlos Alberto
Carlos Alberto

Posted on

Today date using Javascript

How to write today date using javascript

<html>
<body>
Today date is : 
<script>
var meses = new Array ("01","02","03","04","05","06","07","08","09","10","11","12");
var diasSemana = new Array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado");
var f=new Date();
var today = (diasSemana[f.getDay()] + ", " + f.getDate() + "/" +meses[f.getMonth()] + "/" + f.getFullYear());
document.write(today);
</script>
</body>
</html>

Enter fullscreen mode Exit fullscreen mode

Top comments (0)