Sunday 27 September 2015

Calculate timezone difference for bash epoch time



Lets find difference of time from UTC with epoh time.
tzdifference=$(($(TZ=Europe/Istanbul date +%:::z)*60*60*1000))

And add this to UTC for showing time local.
All time information was epoch time.
cat $filename | sed  's/\\,//g' |  awk -F"," '{print $1","$2","$3","$4","strftime("%F %T",($5+'$tzdifference')/1000)","$6","$7","$8","$9","$10","$11","$12","$13","$14    

No comments: