#!/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"; } # Get date&time without separators #==BEGIN sample code== echo "The current day and time is:$(dateTimeShort)" #==END sample code== # Author: Steven Baltakatei Sandoval # License: GPLv3+