Home Explore Blog CI



postgresql

5th chunk of `doc/src/sgml/datetime.sgml`
faababa8d5458b8e0ca03fccb7ffdde0ad51075b6c8a8bf10000000100000fa2
 id="datetime-config-files">
  <title>Date/Time Configuration Files</title>

   <indexterm>
    <primary>time zone</primary>
    <secondary>input abbreviations</secondary>
   </indexterm>

   <para>
    Since timezone abbreviations are not well standardized,
    <productname>PostgreSQL</productname> provides a means to customize
    the set of abbreviations accepted in datetime input.
    There are two sources for these abbreviations:

    <orderedlist>
     <listitem>
      <para>
       The <xref linkend="guc-timezone"/> run-time parameter is usually
       set to the name of an entry in the IANA time zone database.
       If that zone has widely-used zone abbreviations, they will appear
       in the IANA data, and <productname>PostgreSQL</productname> will
       preferentially recognize those abbreviations with the meanings
       given in the IANA data.
       For example, if <varname>timezone</varname> is set
       to <literal>America/New_York</literal> then <literal>EST</literal>
       will be understood as UTC-5 and <literal>EDT</literal> will be
       understood as UTC-4.  (These IANA abbreviations will also be used
       in datetime output, if <xref linkend="guc-datestyle"/> is set to a
       style that prefers non-numeric zone abbreviations.)
      </para>
     </listitem>

     <listitem>
      <para>
       If an abbreviation is not found in the current IANA time zone,
       it is sought in the list specified by the
       <xref linkend="guc-timezone-abbreviations"/> run-time parameter.
       The <varname>timezone_abbreviations</varname> list is primarily
       useful for allowing datetime input to recognize abbreviations for
       time zones other than the current zone.  (These abbreviations will
       not be used in datetime output.)
      </para>
     </listitem>
    </orderedlist>
   </para>

   <para>
    While the <varname>timezone_abbreviations</varname> parameter
    can be altered by any database user, the possible values for it
    are under the control of the database administrator &mdash; they
    are in fact names of configuration files stored in
    <filename>.../share/timezonesets/</filename> of the installation directory.
    By adding or altering files in that directory, the administrator
    can set local policy for timezone abbreviations.
   </para>

   <para>
    <varname>timezone_abbreviations</varname> can be set to any file name
    found in <filename>.../share/timezonesets/</filename>, if the file's name
    is entirely alphabetic.  (The prohibition against non-alphabetic
    characters in <varname>timezone_abbreviations</varname> prevents reading
    files outside the intended directory, as well as reading editor
    backup files and other extraneous files.)
   </para>

   <para>
    A timezone abbreviation file can contain blank lines and comments
    beginning with <literal>#</literal>.  Non-comment lines must have one of
    these formats:

<synopsis>
<replaceable>zone_abbreviation</replaceable> <replaceable>offset</replaceable>
<replaceable>zone_abbreviation</replaceable> <replaceable>offset</replaceable> D
<replaceable>zone_abbreviation</replaceable> <replaceable>time_zone_name</replaceable>
@INCLUDE <replaceable>file_name</replaceable>
@OVERRIDE
</synopsis>
   </para>

   <para>
    A <replaceable>zone_abbreviation</replaceable> is just the abbreviation
    being defined.  An <replaceable>offset</replaceable> is an integer giving
    the equivalent offset in seconds from UTC, positive being east from
    Greenwich and negative being west.  For example, -18000 would be five
    hours west of Greenwich, or North American east coast standard time.
    <literal>D</literal> indicates that the zone name represents local
    daylight-savings time rather than standard time.
   </para>

   <para>
    Alternatively, a <replaceable>time_zone_name</replaceable> can be given, referencing
    a zone name defined in the IANA timezone database.  The zone's definition
    is consulted to see

Title: Configuring Time Zone Abbreviations in PostgreSQL
Summary
PostgreSQL allows customization of time zone abbreviations through two sources: the IANA time zone database and a configurable list specified by the timezone_abbreviations parameter, which can be set to a file name in the .../share/timezonesets/ directory, enabling database administrators to define local policy for timezone abbreviations and users to recognize abbreviations for time zones other than the current zone.