summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjak1 <mike.wollmann@gmail.com>2021-08-01 23:11:24 +0200
committerjak1 <mike.wollmann@gmail.com>2021-08-01 23:11:24 +0200
commit74a41caff6e7274c6926f5ae26b4180c920bb3dc (patch)
treec13a5abd46210880e2638df3f9c677c53e79769a
parent19779e744cc24457503483f6b171b32b3110f3b5 (diff)
downloadthepixelworld-74a41caff6e7274c6926f5ae26b4180c920bb3dc.tar.gz
thepixelworld-74a41caff6e7274c6926f5ae26b4180c920bb3dc.tar.bz2
thepixelworld-74a41caff6e7274c6926f5ae26b4180c920bb3dc.tar.xz
thepixelworld-74a41caff6e7274c6926f5ae26b4180c920bb3dc.zip
fixed timestamp formating
-rw-r--r--app.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/app.js b/app.js
index d219310..5862d80 100644
--- a/app.js
+++ b/app.js
@@ -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