Skip to content

Instantly share code, notes, and snippets.

@mrkschan
Created April 11, 2012 09:01
Show Gist options
  • Save mrkschan/2358097 to your computer and use it in GitHub Desktop.
Save mrkschan/2358097 to your computer and use it in GitHub Desktop.
a shortcut program to convert timezone
#!/bin/bash
# Usage: tz.sh from-timezone to-timezone time
# Example: tz.sh America/Los_Angeles America/New_York '2000-01-01 00:01:02'
from=$1
to=$2
if [[ "$3" == "" ]]; then
time=`date -R`
else
time=$3
fi
TZ="$from" date -R --date "$time" | TZ="$to" xargs -I {} date -R --date {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment