@@ -7963,10 +7963,11 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
7963
7963
</indexterm>
7964
7964
7965
7965
<para>
7966
- The <literal>AT TIME ZONE</literal> construct allows conversions
7967
- of time stamps to different time zones. <xref
7968
- linkend="functions-datetime-zoneconvert-table"> shows its
7969
- variants.
7966
+ The <literal>AT TIME ZONE</literal> converts time
7967
+ stamp <emphasis>without time zone</emphasis> to/from
7968
+ time stamp <emphasis>with time zone</emphasis>, and
7969
+ <emphasis>time</emphasis> values to different time zones. <xref
7970
+ linkend="functions-datetime-zoneconvert-table"> shows its variants.
7970
7971
</para>
7971
7972
7972
7973
<table id="functions-datetime-zoneconvert-table">
@@ -8011,24 +8012,33 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
8011
8012
8012
8013
<para>
8013
8014
In these expressions, the desired time zone <replaceable>zone</> can be
8014
- specified either as a text string (e.g., <literal>'PST '</literal>)
8015
+ specified either as a text string (e.g., <literal>'America/Los_Angeles '</literal>)
8015
8016
or as an interval (e.g., <literal>INTERVAL '-08:00'</literal>).
8016
8017
In the text case, a time zone name can be specified in any of the ways
8017
8018
described in <xref linkend="datatype-timezones">.
8018
8019
</para>
8019
8020
8020
8021
<para>
8021
- Examples (assuming the local time zone is <literal>PST8PDT</ >):
8022
+ Examples (assuming the local time zone is <literal>America/Los_Angeles</literal >):
8022
8023
<screen>
8023
- SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'MST ';
8024
+ SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'America/Denver ';
8024
8025
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 19:38:40-08</computeroutput>
8025
8026
8026
- SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'MST ';
8027
+ SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'America/Denver ';
8027
8028
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 18:38:40</computeroutput>
8029
+
8030
+ SELECT TIMESTAMP '2001-02-16 20:38:40-05' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE 'America/Chicago';
8031
+ <lineannotation>Result: </lineannotation><computeroutput>2001-02-16 05:38:40</computeroutput>
8028
8032
</screen>
8029
- The first example takes a time stamp without time zone and interprets it as MST time
8030
- (UTC-7), which is then converted to PST (UTC-8) for display. The second example takes
8031
- a time stamp specified in EST (UTC-5) and converts it to local time in MST (UTC-7).
8033
+ The first example adds a time zone to a value that lacks it, and
8034
+ displays the value using the current <varname>TimeZone</varname>
8035
+ setting. The second example shifts the time stamp with time zone value
8036
+ to the specified time zone, and returns the value without a time zone.
8037
+ This allows storage and display of values different from the current
8038
+ <varname>TimeZone</varname> setting. The third example converts
8039
+ Tokyo time to Chicago time. Converting <emphasis>time</emphasis>
8040
+ values to other time zones uses the currently active time zone rules
8041
+ since no date is supplied.
8032
8042
</para>
8033
8043
8034
8044
<para>
0 commit comments