-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
25 lines (22 loc) · 863 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//Variables
const hora = document.querySelector("#hour");
const fecha = document.querySelector("#fecha");
const monthNames = ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];
document.addEventListener('DOMContentLoaded',change);
function change (){
setInterval(() => {
let date = new Date();
let dateFecha = {
day: date.getDate(),
month: date.getMonth(),
year:date.getFullYear(),
};
let dateHour = {
hour:date.getHours(),
minutes:date.getMinutes(),
seconds:date.getSeconds(),
};
hora.textContent = `${dateHour.hour}:${dateHour.minutes}:${dateHour.seconds}`;
fecha.textContent = `${dateFecha.day} ${monthNames[dateFecha.month]} ${dateFecha.year}`;
},1000);
};