Tag Info

Hot answers tagged

44

You should be able to 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. This sets the TZ variable only for the command line.


30

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. $ ls /usr/share/zoneinfo/ Africa/ CET Etc/ Hongkong Kwajalein Pacific/ ROK zone.tab America/ ...


19

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


15

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


15

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


13

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


12

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.


11

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


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

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


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


8

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


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

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


7

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


7

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)


6

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


6

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.


6

OK, I have stumbled upon the solution. Here's the link where I got the info from: http://brickybox.com/2009/10/18/os-x-fix-argentina-dst-october-2009 The tzdata source has changed its url. It is now to be found at: ftp://ftp.iana.org/tz/ or http://www.iana.org/time-zones for more information. I downloaded the updated tzdata-file: in this case ...


6

Whenever you specify a timezone in the format of +/-00:00, you are specifying an offset, not the actual timezone. From the GNU libc documentation (which follows the POSIX standard): The offset specifies the time value you must add to the local time to get a Coordinated Universal Time value. It has syntax like [+|-]hh[:mm[:ss]]. This is positive if ...


5

You can use NTP (Network Time Protocol) if this machine is Internet connected. This will synchronize the machine's clock to an Internet time server. yum install ntp, then edit the /etc/ntp.conf file so that you have at least one line that looks like: server 0.pool.ntp.org Then chkconfig ntpd on so that it will start up automatically on boot. Once this ...


5

Since you've found that dpkg-reconfigure tzdata works, why don't you use it? If the problem is that it's interactive and you want to script the change, it's possible. The timezone is configured through debconf. You can set values with debconf-set-selections. Then reconfigure the package, telling it not to prompt for anything. debconf-set-selections ...


5

If you just want to convert existing syslog files you can e.g. use a small python/perl/ruby program to change Tue Apr 23 07:23:24 EDT 2013 in something with UTC (or CET). If you want to have more control over the time format that is written in the log file, you might want to look at syslog-ng. Its tsformat() function allows you to configure the time format ...


5

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


5

The system clock and the hardware clock are not the same. The command hwclock -r should show you the time the hardware clock is set to. If it is incorrect, use the command hwclock -w to update it when the time is correct. If you dual boot with windows, you will want to use local time. Otherwise, you may want to set the harward clock to UTC with the ...


5

The date command, like almost all programs, relies on the standard library to access timezone data. On Linux (except for some embedded systems) and *BSD, the standard library determines the current timezone from the content of /etc/localtime. It appears that on your system, /etc/localtime does not contain what it seems to contain. Like Stéphane Chazelas and ...


5

This will likely depend on your OS and it's implementation of cron. This is not possible in the most popular cron implementation, vixie/isc cron. From the crontab(5) manpage: LIMITATIONS The cron daemon runs with a defined timezone. It currently does not support per-user timezones. All the tasks: system's and user's will be run ...


4

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


4

A thread titled A renewed plea for inclusion of zone.tab offers some explanation of what zone.tab is used for. Its main use seems to be to show a map of cities and their locations, to allow a user to pick their timezone by clicking on a city near them. With that in mind, it doesn't need to know all of the aliases for each city, knowing one preferred way of ...



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