Skip to content

Commit 65d7981

Browse files
#14 - JavaScript
1 parent 4d4e44f commit 65d7981

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Los objetos Date representan en JavaScript un momento fijo en el tiempo en un formato independiente.
3+
*/
4+
5+
//---EJERCIÓ---
6+
7+
// Asi se representa las fechas en JavaScript
8+
// Variable de la fecha actual (Hora Central)
9+
const fecha = new Date();
10+
console.log(fecha);
11+
12+
// Fecha en Mexico
13+
console.log(fecha.toLocaleString());
14+
15+
16+
// Variable de fecha de nacimiento
17+
const fecha_Nacimiento = new Date(1999, 12, 22, 22, 30, 1, 2); // Aquí se pone la fecha de nacimiento
18+
const diferenciaFechas = Date.now() - fecha_Nacimiento.getTime();
19+
const añosTranscurridos = Math.floor(diferenciaFechas/ (1000 * 60 * 60 * 24 * 365.5));
20+
console.log(añosTranscurridos);
21+
22+
23+
24+
/**-----DIFICULTAD EXTRA-----*/
25+
//Pendientes
26+
/**-----DIFICULTAD EXTRA-----*/

0 commit comments

Comments
 (0)