Skip to content

Instantly share code, notes, and snippets.

@jasp402
Created June 14, 2021 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasp402/89efb59853bc4a89e55942ed8d097a09 to your computer and use it in GitHub Desktop.
Save jasp402/89efb59853bc4a89e55942ed8d097a09 to your computer and use it in GitHub Desktop.
Tanformar numeros a fecha
//Input
let d = '210614164612';
//Conver
let year = d.slice(0, 2);
let month = d.slice(2, 4);
let day = d.slice(4, 6);
let hour = d.slice(6, 8);
let min = d.slice(8, 10);
let sec = d.slice(10,12);
//out
let fecha = `${day}/${month}/20${year} ${hour}:${min}:${sec}`;
console.log(fecha);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment