make minutes have 0 in javascript
snippet in javascript

make minutes have 0 in javascript

user8853

String(date.getMinutes()).padStart(2, "0");

sets expected result as having two digits, if one is missing replace it with 0;

javascript date get minutes with leading zero

user3783

mins = ('0'+current_date.getMinutes()).slice(-2);