DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(cvs.info.gz) Specifying time zone rules

Info Catalog (cvs.info.gz) Seconds since the Epoch (cvs.info.gz) Date input formats (cvs.info.gz) Authors of get_date
 
 A.6.9 Specifying time zone rules
 --------------------------------
 
 Normally, dates are interpreted using the rules of the current time
 zone, which in turn are specified by the `TZ' environment variable, or
 by a system default if `TZ' is not set.  To specify a different set of
 default time zone rules that apply just to one date, start the date
 with a string of the form `TZ="RULE"'.  The two quote characters (`"')
 must be present in the date, and any quotes or backslashes within RULE
 must be escaped by a backslash.
 
    For example, with the GNU `date' command you can answer the question
 "What time is it in New York when a Paris clock shows 6:30am on October
 31, 2004?" by using a date beginning with `TZ="Europe/Paris"' as shown
 in the following shell transcript:
 
      $ export TZ="America/New_York"
      $ date --date='TZ="Europe/Paris" 2004-10-31 06:30'
      Sun Oct 31 01:30:00 EDT 2004
 
    In this example, the `--date' operand begins with its own `TZ'
 setting, so the rest of that operand is processed according to
 `Europe/Paris' rules, treating the string `2004-10-31 06:30' as if it
 were in Paris.  However, since the output of the `date' command is
 processed according to the overall time zone rules, it uses New York
 time.  (Paris was normally six hours ahead of New York in 2004, but
 this example refers to a brief Halloween period when the gap was five
 hours.)
 
    A `TZ' value is a rule that typically names a location in the `tz'
 database (http://www.twinsun.com/tz/tz-link.htm).  A recent catalog of
 location names appears in the TWiki Date and Time Gateway
 (http://twiki.org/cgi-bin/xtra/tzdate).  A few non-GNU hosts require a
 colon before a location name in a `TZ' setting, e.g.,
 `TZ=":America/New_York"'.
 
    The `tz' database includes a wide variety of locations ranging from
 `Arctic/Longyearbyen' to `Antarctica/South_Pole', but if you are at sea
 and have your own private time zone, or if you are using a non-GNU host
 that does not support the `tz' database, you may need to use a POSIX
 rule instead.  Simple POSIX rules like `UTC0' specify a time zone
 without daylight saving time; other rules can specify simple daylight
 saving regimes.   Specifying the Time Zone with `TZ' (libc)TZ
 Variable.
 
Info Catalog (cvs.info.gz) Seconds since the Epoch (cvs.info.gz) Date input formats (cvs.info.gz) Authors of get_date
automatically generated byinfo2html