我想格式化这样的日期:
May 02 2013
但目前,我的格式如下所示:
May 2 2013
我怎样才能对这种类型的日期进行零填充,以便日期中的日期类似于02
而不是只是2
?
这是我正在使用的代码:
var m_names = new Array("January", "February", "March",
"April", "May", "June", "July", "August", "September",
"October", "November", "December");
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
var curr_year = d.getFullYear();
alert( m_names[curr_month] + " " +curr_date + " " + curr_year);