From: Steven Baltakatei Sandoval Date: Mon, 29 Jun 2020 11:07:26 +0000 (+0000) Subject: feat(unitproc):Add template dateShort X-Git-Tag: 0.2.0~25 X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/commitdiff_plain/fc1495ab3996d2ded45e6e5ef71d1d256f5eede0?ds=sidebyside;hp=-c feat(unitproc):Add template dateShort Produces current date without separators. --- fc1495ab3996d2ded45e6e5ef71d1d256f5eede0 diff --git a/unitproc/bktemp-dateShort b/unitproc/bktemp-dateShort new file mode 100644 index 0000000..425cf85 --- /dev/null +++ b/unitproc/bktemp-dateShort @@ -0,0 +1,19 @@ +#!/bin/bash + +# Desc: Template to display date + +dateShort(){ + # Desc: Date without separators (YYYYmmdd) + # Usage: dateShort + # Output: stdout: date (ISO-8601, no separators) + TIME_CURRENT="$(date --iso-8601=seconds)" ; # Produce `date`-parsable current timestamp with resolution of 1 second. + DATE_CURRENT_SHORT="$(date -d "$TIME_CURRENT" +%Y%m%d)"; # Produce separator-less current date with resolution 1 day. + echo "$DATE_CURRENT_SHORT"; +} # Get date without separators + +#==BEGIN sample code== +echo "The current day is:$(dateShort)" +#==END sample code== + +# Author: Steven Baltakatei Sandoval +# License: GPLv3+