I am using a function to log some stuff that happens in the background and this is the code I use to get the date and hour, etc.
function fStartLog() {
var oDate = new Date();
var sDate = oDate.getDate() +"/"+ oDate.getMonth() +"/"+ oDate.getFullYear() +" - "+ oDate.getHours() +":"+ oDate.getMinutes() +":"+ oDate.getSeconds();
console.log("["+ sDate +"] mysite.com > Loading DONE!");
}
My question is, how can I get the date in a format with zeroes. Example:
[WRONG] 5/7/2013 - 22:5:9
[GOOD] 05/07/2013 - 22:05:09