-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJava.js
More file actions
69 lines (48 loc) · 1.66 KB
/
Java.js
File metadata and controls
69 lines (48 loc) · 1.66 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
(function(){
var actualizarHora = function(){
var fecha = new Date(),
horas = fecha.getHours(),
ampm,
minutos = fecha.getMinutes(),
segundos = fecha.getSeconds(),
diaSemana = fecha.getDay(),
dia = fecha.getDate(),
mes = fecha.getMonth(),
year = fecha.getFullYear();
var pHoras = document.getElementById("horas"),
pAMPM = document.getElementById("ampm"),
pMinutos = document.getElementById("minutos"),
pSegundos = document.getElementById("segundos"),
pDiaSemana = document.getElementById("diaSemana")
pDia = document.getElementById("dia"),
pMes = document.getElementById("mes"),
pYear = document.getElementById("year");
var semana = ["Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sábado"];
pDiaSemana.textContent = semana [diaSemana];
pDia.textContent = dia;
var meses = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]
pMes.textContent = meses [mes];
pYear.textContent = year;
if (horas >= 12) {
horas = horas - 12;
ampm = "PM";
} else{
ampm = "AM";
}
if (horas == 0) {
horas = 12;
}
pHoras.textContent = horas;
pAMPM.textContent = ampm;
if (minutos < 10){
minutos = "0" + minutos
};
if (segundos < 10){
segundos = "0" + segundos
};
pMinutos.textContent = minutos;
pSegundos.textContent = segundos;
};
actualizarHora();
var intervalo = setInterval (actualizarHora, 1000);
}())