Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quickly change timezone from the command line
# I make an abbreviation with `abbr --add ct change_timezone` and then just type `ct ny`.
function change_timezone --description "Change timezone to; LA or NY"
set --local zone $argv[1]
if string match --ignore-case --quiet 'LA' $zone
timedatectl set-timezone America/Los_Angeles
echo 'set zone to America/Los_Angeles'
else if string match --ignore-case --quiet 'NY' $zone
timedatectl set-timezone America/New_York
echo 'set zone to America/New_York'
else
echo 'timezone not recognized, must be LA or NY'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment