I am working on linux Ubuntu, I want a bash script that the output is to convert the timezone 7 hours in advance from my server time.My server time: Mon Jul 23 23:00:00 2017What I want to achieve:Mon Jul 24 06:00:00 2017So I have tried this one on my bash script:#!/bin/bashlet var=$(date +%H)*3600+$(date +%M)*60+$(date +%S)seven=25200time=$(($var+$seven))date=$(date --date='TZ=UTC+7' +%Y-%m-%d)hours=$(date -d@$time -u +%H:%M:%S)echo $date $hoursthe output was:2017-07-23  06:00:00The hours works but the date still following the server date. Is there any other ways to solve the date? Thank you. And sorry for the english
How to change time zone in a bash script?
linux;ubuntu;bash
Taking your question literally, if you just want to get a date string for 7 hours later than the current time in the current zone, that's easy:date -d 7 hours +%Y-%m-%d %H:%M:%SIf what you're really wanting to do is pull the local date/time in some other timezone, though, then you'd be better off following the advice in some of the other answers.