Answers for "js date is created without leading zeros"

-1

javascript date get minutes with leading zero

mins = ('0'+current_date.getMinutes()).slice(-2);
Posted by: Guest on September-08-2020
0

Javascript add leading zeroes to date

var MyDate = new Date();
var MyDateString;

MyDate.setDate(MyDate.getDate() + 20);

MyDateString = ('0' + MyDate.getDate()).slice(-2) + '/'
             + ('0' + (MyDate.getMonth()+1)).slice(-2) + '/'
             + MyDate.getFullYear();
Posted by: Guest on January-07-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language