feat(unitproc):Add template dateShort
[BK-2020-03.git] / unitproc / bktemp-dateShort
1 #!/bin/bash
2
3 # Desc: Template to display date
4
5 dateShort(){
6 # Desc: Date without separators (YYYYmmdd)
7 # Usage: dateShort
8 # Output: stdout: date (ISO-8601, no separators)
9 TIME_CURRENT="$(date --iso-8601=seconds)" ; # Produce `date`-parsable current timestamp with resolution of 1 second.
10 DATE_CURRENT_SHORT="$(date -d "$TIME_CURRENT" +%Y%m%d)"; # Produce separator-less current date with resolution 1 day.
11 echo "$DATE_CURRENT_SHORT";
12 } # Get date without separators
13
14 #==BEGIN sample code==
15 echo "The current day is:$(dateShort)"
16 #==END sample code==
17
18 # Author: Steven Baltakatei Sandoval
19 # License: GPLv3+