commit f46044b1bcd65772895736828c8454e690bc4f02 parent 859e9c84cee2b256a761cbe05c2defe55771ebf7 Author: dwrz <dwrz@dwrz.net> Date: Sat, 21 Oct 2023 20:53:14 +0000 Add datetime script Diffstat:
A | scripts/datetime | | | 14 | ++++++++++++++ |
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/scripts/datetime b/scripts/datetime @@ -0,0 +1,14 @@ +#!/bin/sh + +now="" + +case "$1" in + "iso") now="$(date '+%Y-%m-%dT%H:%M:%S%:z')" ;; + "mime") now="$(date '+%a, %d %b %Y %H:%M:%S %z')" ;; + "unix") now="$(date +%s)" ;; + # u2h coverts UNIX to ISO. + "u2h") now="$(date -d "@$2" '+%Y-%m-%dT%H:%M:%S%:z')" ;; + *) now="$(date "$@")" +esac + +echo "${now}" | tee /dev/tty | xclip