Skip to content

Instantly share code, notes, and snippets.

@amanmeghrajani
Created August 28, 2018 21:03
Show Gist options
  • Save amanmeghrajani/fafb433d6f7d0bd43a5961fa712d86c4 to your computer and use it in GitHub Desktop.
Save amanmeghrajani/fafb433d6f7d0bd43a5961fa712d86c4 to your computer and use it in GitHub Desktop.
const getHumanizedDateTime = (yyyymmddhhmmss) => {
let components = yyyymmddhhmmss.split('');
let year = components.splice(0,4).join('');
let month = components.splice(0,2).join('');
let day = components.splice(0,2).join('');
let hour = components.splice(0,2).join('');
let minute = components.splice(0,2).join('');
let second = components.join('');
let humanized = `${month}/${day}/${year} - ${hour}:${minute}:${second}`;
console.log(humanized);
return humanized;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment