30 lines
531 B
Bash
Executable File
30 lines
531 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# List of time zones to iterate through
|
|
timezones=(
|
|
"UTC"
|
|
"America/Los_Angeles"
|
|
#"Europe/London"
|
|
"Europe/Stockholm"
|
|
)
|
|
sep="------------------------------------------------"
|
|
|
|
time="$1"
|
|
if [ -z "$1" ]; then
|
|
time="now"
|
|
fi
|
|
|
|
echo $sep
|
|
echo "My Time:"
|
|
TZ="$(cat /etc/timezone)" date -d "@$(date -d "$time" +%s)"
|
|
echo $sep
|
|
|
|
# Loop through each time zone and calculate the new time
|
|
for tz in "${timezones[@]}"
|
|
do
|
|
echo "Timezone: $tz"
|
|
TZ="$tz" date -d "@$(date -d "$time" +%s)"
|
|
echo $sep
|
|
done
|
|
|