Tag Info

Hot answers tagged

29

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.


13

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


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

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


10

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


9

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.


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


7

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.


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

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


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

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

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

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


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


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

You don't say how you set the timezone, but since you set it for your own user, that has to be by setting the TZ variable. Bash (at least version 4.1.5) has some quirks when it comes to taking a TZ change into account: the change is only reflected after the shell has started an external command (it has to be an external command, forking a subshell isn't ...


4

To expand slightly upon @frostschutz comment, the TZ environment variable is present in large part to allow exactly what you desire: having programs show you time information in your preferred zone. Indeed, Unix system clocks all run on UTC (GMT-like) and things like file timestamps and what your clock program gets back from the system is in UTC. Programs ...


4

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


4

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)


4

If some state has its timezone changed (by a law...) but not the other one (or if this happened in the past and you look at dates in the past), you'll get an incorrect timezone. Otherwise there are no differences.


3

Try: dpkg-reconfigure tzdata That should allow to set the timezone for the system (make a copy of the selected timezone file onto /etc/timezone). More generally, it can be difficult to figure out which package you need to configure to change a setting as it's not always obvious. Things that can help: If you know the configure file where that setting is ...


3

Time zone data in modern UNIX systems comes from the public-domain IANA Time Zone Database. This database is what provides the timezone names, and the complex and ever-changing rules for timezones themselves. Wikipedia has a good overview of the database and the various formats in which it can be found, and includes a list of timezones from that database.


3

This depends on your distribution: some versions of Cron support this, others don't. For example, on Debian: 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 based on the configured timezone. Even if a user specifies the TZ environment variable in ...


3

From the Wikipedia article on the tz database: The special area of Etc is used for some administrative zones, particularly for "Etc/UTC" which represents Coordinated Universal Time. In order to conform with the POSIX style, those zone names beginning with "Etc/GMT" have their sign reversed from what most people expect. In this style, zones west of GMT ...


3

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


3

By "days" it means 86,400 second intervals. By "January 1, 1970", it means 00:00:00 UTC. This is basically standard UNIX time, also known as POSIX time.



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