var date = \"2012-01-18T16:03\"; var date = new Date(date); console.log(date.getMinutes()); console.log(date.getMinutes().length)
This returns 3.
I dont see any ES6 answers on here so I will add one using StandardJS formatting
// ES6 String formatting example const time = new Date() const tempMinutes = new Date.getMinutes() const minutes = (tempMinutes < 10) ? `0${tempMinutes}` : tempMinutes