Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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();
 
PREVIOUS NEXT
Tagged: #How #I #Month #Date #JavaScript #digit #format
ADD COMMENT
Topic
Name
7+5 =