Created
August 28, 2018 21:03
-
-
Save amanmeghrajani/fafb433d6f7d0bd43a5961fa712d86c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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