Take a look at this blog post titled: How To: 2 Methods To Change TimeZone in Linux.
Red Hat distros
If you're using a distribution such as Red Hat then your approach of copying the file would be mostly acceptable.
NOTE: If you're looking for a distro-agnostic solution, this also works on Debian, though there are simpler approaches below if you only need ...
You can set a timezone for the duration of the query, thusly:
Note the whitespace between the TZ setting and the date command. In Bourne-like and rc-like shell, that sets the TZ variable only for the command line. In other shells (csh, tcsh, fish), you can always use the env command instead:
env TZ=America/New_York date
The problem is the daylight saving time changed and forwarded 1 hour, on 16 October 2016 in your timezone:
$ zdump -v America/Sao_Paulo | awk '/Oct 16/ && /2016/'
America/Sao_Paulo Sun Oct 16 02:59:59 2016 UTC = Sat Oct 15 23:59:59 2016 BRT isdst=0
America/Sao_Paulo Sun Oct 16 03:00:00 2016 UTC = Sun Oct 16 01:00:00 2016 BRST isdst=1
So any time ...
I wrote a program a while ago that does this: tzupdate.
You can see what it would set your timezone to (without actually setting it) by running tzupdate -p:
$ tzupdate -p
You can set it for real by running tzupdate as root.
$ sudo tzupdate
Thu 12 Sep 05:52:22 CEST 2013
This works by:
Geolocating your current IP
You can do this by manipulating the TZ environment variable. The following will give you the local time for US/Eastern, which will also be smart enough to handle DST when that rolls around:
# all on one line
TZ=":US/Eastern" date +%Y%m%d
The zone name comes from the files and directories inside /usr/share/zoneinfo.
The most appropriate command would appear to be zdump.
$ zdump /etc/localtime
/etc/localtime Wed Aug 7 23:52:25 2013 EDT
$ zdump /usr/share/zoneinfo/* | tail -10
/usr/share/zoneinfo/Singapore Thu Aug 8 11:52:48 2013 SGT
/usr/share/zoneinfo/Turkey Thu Aug 8 06:52:48 2013 EEST
/usr/share/zoneinfo/UCT Thu Aug 8 03:52:48 2013 UCT
The reason is that TZ=UTC-8 is interpreted as a POSIX time zone. In the POSIX timezone format, the 3 letters are the timezone abbreviation (which is arbitrary) and the number is the number of hours the timezone is behind UTC. So UTC-8 means a timezone abbreviated "UTC" that is −8 hours behind the real UTC, or UTC + 8 hours.
(It works that way ...
Timezones are listed in /usr/share/zoneinfo. If you wanted the current time in Singapore, for example, you could pass that to date:
Sun Jun 14 17:17:49 SGT 2015
To simplify this procedure, if you need to frequently establish the local time in different timezones, you could add a couple of functions to your shell rc file (eg, .bashrc):...
This is how I do it in Ubuntu. Just replace Asia/Tokyo with your own timezone.
echo 'Asia/Tokyo' | sudo tee /etc/timezone
sudo dpkg-reconfigure -f noninteractive tzdata
There is a bug in tzdata: certain values get normalized by dpkg-reconfigure:
echo 'US/Central' >/etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# Current default time zone: '...
Be careful! Date will happily spit out the time in your CURRENT timezone, if you give it a timezone it doesn't recognize.
Check this out:
-bash-4.2$ env TZ=EDT date
Wed Feb 18 19:34:41 EDT 2015
Wed Feb 18 19:34:43 UTC 2015
Note that there is no timezone called EDT. As a matter of fact,
-bash-4.2$ find /usr/share/zoneinfo -name "*EDT*"
You can use date -u (universal time) which is equivalent to GMT.
Quoting date manual:
‘-u’ ‘--utc’ ‘--universal’
Use Universal Time by operating as if the ‘TZ’ environment variable
were set to the string ‘UTC0’. UTC stands for Coordinated
Universal Time, established in 1960. Universal Time is often
called “Greenwich Mean Time” ...
There are DST-free timezone definitions provided which just define the GMT-offset, called Etc/GMT±X:
Mon Apr 7 11:08:56 CEST 2014
$ TZ=Etc/GMT-1 date
Mon Apr 7 10:09:16 GMT-1 2014
Just link/copy the one you need to /etc/localtime and you should be fine and DST-free:
$ ln -s /usr/share/zoneinfo/Etc/GMT-1 /etc/localtime
Edit: For non-integer ...
Use the TZ environment variable. E.g.:
bash$ export TZ=US/Pacific
Mon Mar 3 00:31:17 PST 2014
bash$ export TZ=US/Eastern
Mon Mar 3 03:33:06 EST 2014
The possible values for TZ are in the directory /usr/share/zoneinfo (see, for example, the existence of /usr/share/zoneinfo/US/Pacific)
This sounds like your device is using the Pacific-New timezone, which is a proposed timezone that never became law in the US, and which specifies a switch to daylight-savings time on the first Sunday of April:
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
## Rule Twilite XXXX max - Apr Sun>=1 2:00 1:...
You can use zdump:
zdump - timezone dumper
zdump [ --version ] [ --help ] [ -v ] [ -c [loyear,]hiyear ] [ zonename ... ]
Zdump prints the current time in each zonename named on the command line.
$ zdump ~$ zdump Iceland
Iceland Sun Jun 14 09:40:30 2015 GMT
$ zdump Japan
Japan Sun Jun 14 18:34:36 ...
It's as simple as typing in just one command:
timedatectl set-timezone Zone/SubZone
Where you replace Zone/SubZone with correct data. You can obtain list of all available timezones by typing:
If you want to have your RTC (hardware clock) using local time, run the following command:
timedatectl set-local-rtc 1
If you prefer ...
The date command will give you the current date/time based on your locale.
You can change that, one time only, by prefixing the command with a different timezone
TZ=CST6CDT date # Will print the current time in the USA Central time
TZ=Chicago date # will do the same, iff Chicago is listed by name in the /usr/share/zoneinfo/ dir hierarchy
Then to simplify ...
Separate out the problem: is it a Timezone misconfiguration, or a time configuration? You can use a couple of tools, date and zdump to determine this.
If date reports the correct UTC time, then you know the problem exists in the timezone setting, rather than in the internal time setting.
$ date --utc
Fri Jun 28 14:02:43 UTC 2013
Fri Jun 28 10:02:45 ...
It's possible to display multiple timezones by using multiple applets of the Orage Clock Panel.
Under Orage properties (right click on the clock -> properties) there is a button next to 'set timezone to:' labeled Open. Clicking that button will bring up a window that allows you to select which timezone you want that applet to use.
Each applet will use the ...
Almost all programs use the TZ environment variable to determine the timezone, and fall back to the system setting if that variable is not set.
Almost all operating systems (even Windows) use timezone information from the IANA database. Most timezones have a name of the form Continent/Town where Town is typically ...
The "seconds since 1970" timestamp is specifically defined as UTC in most usages. In particular, you may notice that date +%s gives the same result as date -u +%s.
The relevant line where this is set in the shadow password utilities is"
nsp->sp_lstchg = (long) time ((time_t *) 0) / SCALE;
Which would make it UTC.
SCALE is defined as 86400 (except via a ...
If you cannot choose a language that better correlates to your location, just install with any timezone. When the install is finished, as root, run the command tzselect to set a new timezone. Also, consider filing a bug against the debian installer if you truly cannot pick your language and your timezone properly.
First, you need some configs for ssh server and ssh client.
In Server, in /etc/ssh/sshd_config, make sure you accept TZ variable:
AcceptEnv LANG LC_* TZ
In Client, in /etc/ssh/ssh_config or ~/.ssh/config, make sure you send TZ variable:
(The defaults are usually to send none from the client, and accept none on the server.)
Then make alias ...