Possible Duplicate:
Javascript add leading zeroes to date
It might be a simple question because I am still newbie in JavaScript, assume I have DateTime in ISO format:
2012-07-07T17:00:00
I would like to format this date to string:
07.07.2012
I have written a function to format to 7.7.2012 as below:
var formatDate = function (datum) {
var date = new Date(datum);
return date.getDate() + '.' + (date.getMonth() + 1) + '.' + date.getFullYear();
};
How can I modify this code to get the result 07.07.2012
instead of 7.7.2012