diff options
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -302,15 +302,22 @@ joinArgs = function(argsList, remArgsBefore, remArgsAfter){ return res; } -// gets the current (weird formated) timestamp (FIXME later...) +// gets the current (weird formated) timestamp getTimeStamp = function(){ var date_ob = new Date(); - day = date_ob.getDate(); - month = date_ob.getMonth(); + day = addLeadingZero(date_ob.getDate()); + month = addLeadingZero(date_ob.getMonth()); year = date_ob.getFullYear(); - hours = date_ob.getHours(); - minutes = date_ob.getMinutes(); - seconds = date_ob.getSeconds(); + hours = addLeadingZero(date_ob.getHours()); + minutes = addLeadingZero(date_ob.getMinutes()); + seconds = addLeadingZero(date_ob.getSeconds()); return (year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds); +} + +// formats number (n) to 2-digit +addLeadingZero = function(n){ + if (n <= 9) + return "0"+n; + return n; }
\ No newline at end of file |