datetime (323B)
1 #!/bin/sh 2 3 now="" 4 5 case "$1" in 6 "iso") now="$(date '+%Y-%m-%dT%H:%M:%S%:z')" ;; 7 "mime") now="$(date '+%a, %d %b %Y %H:%M:%S %z')" ;; 8 "unix") now="$(date +%s)" ;; 9 # u2h coverts UNIX to ISO. 10 "u2h") now="$(date -d "@$2" '+%Y-%m-%dT%H:%M:%S%:z')" ;; 11 *) now="$(date "$@")" 12 esac 13 14 echo "${now}" | tee /dev/tty | xclip