Commit | Line | Data |
---|---|---|
fc1495ab SBS |
1 | #!/bin/bash |
2 | ||
3 | # Desc: Template to display date | |
4 | ||
5 | dateShort(){ | |
6 | # Desc: Date without separators (YYYYmmdd) | |
7 | # Usage: dateShort | |
7b6cb145 | 8 | # Version: 1.0.0 |
fc1495ab | 9 | # Output: stdout: date (ISO-8601, no separators) |
b03c9c0c | 10 | local TIME_CURRENT DATE_CURRENT_SHORT |
fc1495ab SBS |
11 | TIME_CURRENT="$(date --iso-8601=seconds)" ; # Produce `date`-parsable current timestamp with resolution of 1 second. |
12 | DATE_CURRENT_SHORT="$(date -d "$TIME_CURRENT" +%Y%m%d)"; # Produce separator-less current date with resolution 1 day. | |
13 | echo "$DATE_CURRENT_SHORT"; | |
50aec114 | 14 | } # Get YYYYmmdd |
fc1495ab SBS |
15 | |
16 | #==BEGIN sample code== | |
17 | echo "The current day is:$(dateShort)" | |
18 | #==END sample code== | |
19 | ||
20 | # Author: Steven Baltakatei Sandoval | |
21 | # License: GPLv3+ |