I am working on Linux Ubuntu, and I want a bash script whose output is to convert the timezone 7 hours in advance from my server time.
My server time:
Mon Jul 23 23:00:00 2017
What I want to achieve:
Mon Jul 24 06:00:00 2017
I have tried this one in my bash script:
#!/bin/bash let var=$(date +%H)*3600+$(date +%M)*60+$(date +%S) seven=25200 time=$(($var+$seven)) date=$(date --date='TZ="UTC+7"' "+%Y-%m-%d") hours=$(date -d@$time -u +%H:%M:%S) echo "$date" "$hours"
the output was:
The hours works, but the date still matches the server date. Is there another way to solve this?