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

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
0

javascript date double digit month

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 "How do I get Month and Date of JavaScript in 2 digit format"

Code answers related to "Javascript"

Browse Popular Code Answers by Language