Skip to content

Instantly share code, notes, and snippets.

@erkiesken
Created July 30, 2020 06:57
Show Gist options
  • Save erkiesken/e13943550c4b2ba03779d5eac5b75e47 to your computer and use it in GitHub Desktop.
Save erkiesken/e13943550c4b2ba03779d5eac5b75e47 to your computer and use it in GitHub Desktop.
bitbar local and utc timezone
#!/usr/bin/env bash
echo "${1}" | pbcopy
#!/usr/bin/env bash
# <bitbar.title>UTC and local timezone</bitbar.title>
# <bitbar.version>v1.0.0</bitbar.version>
# <bitbar.author>Erki Esken</bitbar.author>
# <bitbar.author.github>erkiesken</bitbar.author.github>
# <bitbar.desc>Show the current time in local and UTC timezone.</bitbar.desc>
TIME_UTC=$(TZ="UTC" date "+%H:%M")
TIME_LOCAL=$(date "+%H:%M")
TIME_EPOCH=$(date "+%s")
TIME_DATE=$(date "+%A, %m/%d")
TIME_DATE_ISO=$(TZ="UTC" date "+%Y-%m-%dT%H:%M:00Z")
nice_numbers() {
local s=$1
s="${s//0/๐Ÿถ}"
s="${s//1/๐Ÿท}"
s="${s//2/๐Ÿธ}"
s="${s//3/๐Ÿน}"
s="${s//4/๐Ÿบ}"
s="${s//5/๐Ÿป}"
s="${s//6/๐Ÿผ}"
s="${s//7/๐Ÿฝ}"
s="${s//8/๐Ÿพ}"
s="${s//9/๐Ÿฟ}"
echo "${s}"
}
nice_numbers "๐Ÿ…›โ€‰${TIME_LOCAL} ๐Ÿ…คโ€‰${TIME_UTC}"
echo "---"
echo "${TIME_DATE} | color=#999999"
echo "Unix: ${TIME_EPOCH} | color=#999999 bash='~/bin/pbcopy.sh' param1='${TIME_EPOCH}' terminal=false refresh=false"
echo "${TIME_DATE_ISO}| color=#999999 bash='~/bin/pbcopy.sh' param1='${TIME_DATE_ISO}' terminal=false refresh=false"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment