Created
February 25, 2015 18:54
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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