needsomehelp
01-05-2012, 01:38 AM
I have the following which returns the date in the format I need it in but it does not have the leading zero's
var wholeDate = getTheDay();
function getTheDay(){
var d = new Date();
var year = d.getFullYear();
var numMonth = d.getMonth() + 1;
var day = d.getDate();
var whole = year + '-' + numMonth + '-' + day;
alert(whole);
return whole;
}
Would return todays date as 2012-1-5
How do I get the date returned like
2012-01-05 ?
var wholeDate = getTheDay();
function getTheDay(){
var d = new Date();
var year = d.getFullYear();
var numMonth = d.getMonth() + 1;
var day = d.getDate();
var whole = year + '-' + numMonth + '-' + day;
alert(whole);
return whole;
}
Would return todays date as 2012-1-5
How do I get the date returned like
2012-01-05 ?