@@ -7889,10 +7889,11 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
7889
7889
</indexterm>
7890
7890
7891
7891
<para>
7892
- The <literal>AT TIME ZONE</literal> construct allows conversions
7893
- of time stamps to different time zones. <xref
7894
- linkend="functions-datetime-zoneconvert-table"> shows its
7895
- variants.
7892
+ The <literal>AT TIME ZONE</literal> converts time
7893
+ stamp <emphasis>without time zone</emphasis> to/from
7894
+ time stamp <emphasis>with time zone</emphasis>, and
7895
+ <emphasis>time</emphasis> values to different time zones. <xref
7896
+ linkend="functions-datetime-zoneconvert-table"> shows its variants.
7896
7897
</para>
7897
7898
7898
7899
<table id="functions-datetime-zoneconvert-table">
@@ -7937,24 +7938,33 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
7937
7938
7938
7939
<para>
7939
7940
In these expressions, the desired time zone <replaceable>zone</> can be
7940
- specified either as a text string (e.g., <literal>'PST '</literal>)
7941
+ specified either as a text string (e.g., <literal>'America/Los_Angeles '</literal>)
7941
7942
or as an interval (e.g., <literal>INTERVAL '-08:00'</literal>).
7942
7943
In the text case, a time zone name can be specified in any of the ways
7943
7944
described in <xref linkend="datatype-timezones">.
7944
7945
</para>
7945
7946
7946
7947
<para>
7947
- Examples (assuming the local time zone is <literal>PST8PDT</ >):
7948
+ Examples (assuming the local time zone is <literal>America/Los_Angeles</literal >):
7948
7949
<screen>
7949
- SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'MST ';
7950
+ SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'America/Denver ';
7950
7951
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 19:38:40-08</computeroutput>
7951
7952
7952
- SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'MST ';
7953
+ SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'America/Denver ';
7953
7954
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 18:38:40</computeroutput>
7955
+
7956
+ SELECT TIMESTAMP '2001-02-16 20:38:40-05' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE 'America/Chicago';
7957
+ <lineannotation>Result: </lineannotation><computeroutput>2001-02-16 05:38:40</computeroutput>
7954
7958
</screen>
7955
- The first example takes a time stamp without time zone and interprets it as MST time
7956
- (UTC-7), which is then converted to PST (UTC-8) for display. The second example takes
7957
- a time stamp specified in EST (UTC-5) and converts it to local time in MST (UTC-7).
7959
+ The first example adds a time zone to a value that lacks it, and
7960
+ displays the value using the current <varname>TimeZone</varname>
7961
+ setting. The second example shifts the time stamp with time zone value
7962
+ to the specified time zone, and returns the value without a time zone.
7963
+ This allows storage and display of values different from the current
7964
+ <varname>TimeZone</varname> setting. The third example converts
7965
+ Tokyo time to Chicago time. Converting <emphasis>time</emphasis>
7966
+ values to other time zones uses the currently active time zone rules
7967
+ since no date is supplied.
7958
7968
</para>
7959
7969
7960
7970
<para>
0 commit comments