Answers for "js getmonth with 2 digits"

1

How do I get Month and Date of JavaScript in 2 digit format

let MyDate = new Date();
let MyDateString;

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

MyDateString = ('0' + MyDate.getDate()).slice(-2) + '/'
             + ('0' + (MyDate.getMonth()+1)).slice(-2) + '/'
             + MyDate.getFullYear();
Posted by: Guest on April-27-2020
1

ecmascript 7 getmonth as 2 digits

("0" + this.getDate()).slice(-2)
Posted by: Guest on August-12-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language