feat(unitproc):Add dateTimeShort to get short timestamp
authorSteven Baltakatei Sandoval <baltakatei@gmail.com>
Sun, 28 Jun 2020 19:48:33 +0000 (19:48 +0000)
committerSteven Baltakatei Sandoval <baltakatei@gmail.com>
Sun, 28 Jun 2020 19:48:33 +0000 (19:48 +0000)
unitproc/bktemp-dateTimeShort [new file with mode: 0644]

diff --git a/unitproc/bktemp-dateTimeShort b/unitproc/bktemp-dateTimeShort
new file mode 100644 (file)
index 0000000..d6491c1
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Desc: Template to display date and time.
+
+dateTimeShort(){
+    # Desc: Timestamp without separators (YYYYmmddTHHMMSS+zzzz)
+    # Usage: dateTimeShort
+    # Output: stdout: timestamp (ISO-8601, no separators)
+    TIME_CURRENT="$(date --iso-8601=seconds)" ; # Produce `date`-parsable current timestamp with resolution of 1 second.
+    TIME_CURRENT_SHORT="$(date -d "$TIME_CURRENT" +%Y%m%dT%H%M%S%z)"; # Produce separator-less current timestamp with resolution 1 second.
+    echo "$TIME_CURRENT_SHORT";
+}
+
+#==BEGIN sample code==
+echo "The current day and time is:$(dateTimeShort)"
+#==END sample code==
+
+# Author: Steven Baltakatei Sandoval
+# License: GPLv3+