Michael Kniskern Michael Kniskern - 1 year ago 95
Javascript Question

Get month in mm format in javascript

How do I retrieve the month from the current date in

format? (i.e. "05")

This is my current code:

var currentDate = new Date();
var currentMonth = currentDate.getMonth() + 1;

Answer Source
if (currentMonth < 10) { currentMonth = '0' + currentMonth; }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download