-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1a19f8
commit 3e0bc85
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const now = new Date(Date.now()).getFullYear(); | ||
const birthDate = new Date("1999-06-13").getFullYear(); | ||
let age = now - birthDate; | ||
console.log("han pasado->", age, "años"); | ||
//dificultad extra | ||
const birthDateX = new Date("1999-06-13"); | ||
const fechas = { | ||
formato1: `${birthDateX.getDate()}-${birthDateX.getDay()}-${birthDateX.getFullYear()}`, | ||
formato2: `${birthDateX.getTime()}->milisegundos han pasado desde tu nacimiento`, | ||
formato3: `${birthDateX.getUTCFullYear()}-> welcome to earth boy!!`, | ||
formato4: `${birthDateX.toISOString()}->tu fecha en formato iso`, | ||
formato5: birthDateX.toLocaleString(), | ||
formato6: birthDateX.toLocaleTimeString(), | ||
formato7: birthDateX.toString(), | ||
formato8: birthDateX.toTimeString(), | ||
formato9: birthDateX.toUTCString(), | ||
formato10: `${birthDateX.getDay()}/${birthDateX.getMonth()}/${birthDateX.getFullYear()}` | ||
}; | ||
console.log(fechas); |