summaryrefslogtreecommitdiff
path: root/Base/home/anon/Source/js/date.js
diff options
context:
space:
mode:
Diffstat (limited to 'Base/home/anon/Source/js/date.js')
-rw-r--r--Base/home/anon/Source/js/date.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/Base/home/anon/Source/js/date.js b/Base/home/anon/Source/js/date.js
new file mode 100644
index 0000000000..160786e0bc
--- /dev/null
+++ b/Base/home/anon/Source/js/date.js
@@ -0,0 +1,14 @@
+var now = Date.now();
+console.log("Unix timestamp: " + now / 1000);
+
+var d = new Date();
+var year = d.getFullYear();
+var month = (d.getMonth() + 1).toString().padStart(2, "0");
+var day = d.getDate().toString().padStart(2, "0");
+var hours = d.getHours().toString().padStart(2, "0");
+var minutes = d.getMinutes().toString().padStart(2, "0");
+var seconds = d.getSeconds().toString().padStart(2, "0");
+var milliseconds = d.getMilliseconds().toString().padStart(3, "0");
+
+console.log("Date: " + year + "-" + month + "-" + day);
+console.log("Time: " + hours + ":" + minutes + ":" + seconds + "." + milliseconds);