In a Bash script, I want to print the current datetime in ISO 8601 format (preferably UTC), and it seems that this should be as simple as date -I:
date -I
http://ss
Taking the other answers one step further, you could add a function to your ~/.bashrc or ~/.zshrc to add the date -I flag:
-I
date() { if [ "$1" = "-I" ]; then command date "+%Y-%m-%dT%H:%M:%S%z" else command date "$@" fi }