Skip to content

Instantly share code, notes, and snippets.

@donaldr
Created February 25, 2015 18:54
Show Gist options
  • Save donaldr/abbb8113683a020e4ca8 to your computer and use it in GitHub Desktop.
Save donaldr/abbb8113683a020e4ca8 to your computer and use it in GitHub Desktop.
This is a stupid script to convert time from Google into a busybox date identifiable date.
date=`echo "$(curl -sD - google.com | grep ^Date: | cut -d' ' -f3-6)Z" | tr ":" " "`
read day month year hour minute second <<< $date
months="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"
string="${months%$month*}"
month_num="$((${#string}/4 + 1))"
if [ ${#month_num} == 1 ]; then
month_num=0$month_num
fi
second=${second%Z*}
echo $year$month_num$day$hour$minute.$second
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment