The Stack Overflow podcast is back! Listen to an interview with our new CEO.
273

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 ...


175

You can set a timezone for the duration of the query, thusly: TZ=America/New_York date 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 tl;dr ...


57

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 ...


36

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 Europe/Malta You can set it for real by running tzupdate as root. $ sudo tzupdate Europe/Malta $ date Thu 12 Sep 05:52:22 CEST 2013 This works by: Geolocating your current IP Getting ...


33

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.


33

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 /usr/...


33

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 ...


32

I think the best way to achieve this, is by executing: sudo dpkg-reconfigure tzdata


27

Timezones are listed in /usr/share/zoneinfo. If you wanted the current time in Singapore, for example, you could pass that to date: TZ=Asia/Singapore 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):...


24

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: '...


22

Try this way: $ sudo cp /usr/share/zoneinfo/Australia/Adelaide /etc/localtime


17

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 -bash-4.2$ date 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*" ...


17

tzselect command is made to do what you want.


17

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” ...


15

There are DST-free timezone definitions provided which just define the GMT-offset, called Etc/GMT±X: $ date 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 ...


13

Use the TZ environment variable. E.g.: bash$ export TZ=US/Pacific bash$ date Mon Mar 3 00:31:17 PST 2014 bash$ export TZ=US/Eastern bash$ date 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)


12

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:...


11

You can use zdump: NAME zdump - timezone dumper SYNOPSIS zdump [ --version ] [ --help ] [ -v ] [ -c [loyear,]hiyear ] [ zonename ... ] DESCRIPTION Zdump prints the current time in each zonename named on the command line. Example: $ zdump ~$ zdump Iceland Iceland Sun Jun 14 09:40:30 2015 GMT $ zdump Japan Japan Sun Jun 14 18:34:36 ...


11

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: timedatectl list-timezones If you want to have your RTC (hardware clock) using local time, run the following command: timedatectl set-local-rtc 1 If you prefer ...


10

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 ...


10

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 $ date Fri Jun 28 10:02:45 ...


9

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 ...


9

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. TZ=Pacific/Yap date TZ=Pacific/Yap xclock 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 ...


9

as described here should be enough to timedatectl set-timezone <your_time_zone>


9

Use the following command: TZ=GMT date The same format: TZ=GMT date +"%Y%m%d%H%M%S" 20171225194014


8

Generally, set the TZ environment variable: TZ=America/New_York myapplication I don't know if Wine has its own configuration in addition to or overriding the environment variable.


8

TODAY=$(TZ=":US/Eastern" date) echo $TODAY


8

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 ...


8

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.


8

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: SendEnv TZ (The defaults are usually to send none from the client, and accept none on the server.) Then make alias ...


Only top voted, non community-wiki answers of a minimum length are eligible