Skip to content

Instantly share code, notes, and snippets.

@AlexanderArmua
Last active March 14, 2017 15:59
Show Gist options
  • Save AlexanderArmua/3d0ce1795bb46efadee11ebb145d9daa to your computer and use it in GitHub Desktop.
Save AlexanderArmua/3d0ce1795bb46efadee11ebb145d9daa to your computer and use it in GitHub Desktop.
Get dd/mm/yyyy from epoch / Obtener dd/mm/yyyy de un epoch
getDateFromEpoch(timeEpoch) {
// date = dd/mm/yyyy, hh:mm.
var date = new Date(timeEpoch).toLocaleString("en-GB").toString();
// with substr the return = dd/mm/yyyy
return date.substr(0, fecha.indexOf(","));
}
/*
Documentation about toLocaleString(): https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment