How do I retrieve the month from the current date in mm format? (i.e. \"05\")
This is my current code:
var currentDate = new Date();
va
An alternative with ES6 template strings
A solution for mm/yyyy. Not quite the question, but I guess remove the second part.
const MonthYear = `${dateObj.getMonth() < 10 ? '0' : '' }${dateObj.getMonth()+1}/${dateObj.getFullYear()}`
const Month = `${dateObj.getMonth() < 10 ? '0' : '' }${dateObj.getMonth()+1}`