getMinutes() 0-9 – How to display two digit numbers?

var date = new Date("2012-01-18T16:03");

console.log( (date.getMinutes()<10?'0':'') + date.getMinutes() );

Leave a Comment