Skip to content

Commit

Permalink
Merge pull request #6648 from david-git-dev/main
Browse files Browse the repository at this point in the history
14 - Typescript
  • Loading branch information
Roswell468 authored Oct 19, 2024
2 parents 462ad79 + 3e0bc85 commit 4133d21
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 4133d21

Please sign in to comment.