Skip to content

Commit

Permalink
14 - Typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
david-git-dev committed Oct 18, 2024
1 parent a1a19f8 commit 3e0bc85
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Roadmap/14 - FECHAS/typescript/david-git-dev.ts
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);

0 comments on commit 3e0bc85

Please sign in to comment.