Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save BackSlasher/b3d3654aec1a59cb61599e5d35cd58ba to your computer and use it in GitHub Desktop.
Save BackSlasher/b3d3654aec1a59cb61599e5d35cd58ba to your computer and use it in GitHub Desktop.
#!/bin/bash
FORMAT='+%Y-%m-%d %H:%M:%S'
SHORT_FORMAT='+%H:%M:%S'
my_date() { date "$FORMAT"; }
short_date() { date "$SHORT_FORMAT"; }
CURRENT_TZ="$(timedatectl show | perl -ne 'print $1 if /Timezone=(.*)/')"
HOME_TZ="Asia/Jerusalem"
if [[ "$CURRENT_TZ" == "$HOME_TZ" ]]; then
my_date
else
#echo -n "HOME: $(TZ="$HOME_TZ" short_date) | HERE: $(my_date)"
echo "$(my_date) (HOME: $(TZ="$HOME_TZ" short_date))"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment