@@ -7616,10 +7616,11 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
7616
7616
</indexterm>
7617
7617
7618
7618
<para>
7619
- The <literal>AT TIME ZONE</literal> construct allows conversions
7620
- of time stamps to different time zones. <xref
7621
- linkend="functions-datetime-zoneconvert-table"> shows its
7622
- variants.
7619
+ The <literal>AT TIME ZONE</literal> converts time
7620
+ stamp <emphasis>without time zone</emphasis> to/from
7621
+ time stamp <emphasis>with time zone</emphasis>, and
7622
+ <emphasis>time</emphasis> values to different time zones. <xref
7623
+ linkend="functions-datetime-zoneconvert-table"> shows its variants.
7623
7624
</para>
7624
7625
7625
7626
<table id="functions-datetime-zoneconvert-table">
@@ -7664,24 +7665,33 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
7664
7665
7665
7666
<para>
7666
7667
In these expressions, the desired time zone <replaceable>zone</> can be
7667
- specified either as a text string (e.g., <literal>'PST '</literal>)
7668
+ specified either as a text string (e.g., <literal>'America/Los_Angeles '</literal>)
7668
7669
or as an interval (e.g., <literal>INTERVAL '-08:00'</literal>).
7669
7670
In the text case, a time zone name can be specified in any of the ways
7670
7671
described in <xref linkend="datatype-timezones">.
7671
7672
</para>
7672
7673
7673
7674
<para>
7674
- Examples (assuming the local time zone is <literal>PST8PDT</ >):
7675
+ Examples (assuming the local time zone is <literal>America/Los_Angeles</literal >):
7675
7676
<screen>
7676
- SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'MST ';
7677
+ SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'America/Denver ';
7677
7678
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 19:38:40-08</computeroutput>
7678
7679
7679
- SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'MST ';
7680
+ SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'America/Denver ';
7680
7681
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 18:38:40</computeroutput>
7682
+
7683
+ SELECT TIMESTAMP '2001-02-16 20:38:40-05' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE 'America/Chicago';
7684
+ <lineannotation>Result: </lineannotation><computeroutput>2001-02-16 05:38:40</computeroutput>
7681
7685
</screen>
7682
- The first example takes a time stamp without time zone and interprets it as MST time
7683
- (UTC-7), which is then converted to PST (UTC-8) for display. The second example takes
7684
- a time stamp specified in EST (UTC-5) and converts it to local time in MST (UTC-7).
7686
+ The first example adds a time zone to a value that lacks it, and
7687
+ displays the value using the current <varname>TimeZone</varname>
7688
+ setting. The second example shifts the time stamp with time zone value
7689
+ to the specified time zone, and returns the value without a time zone.
7690
+ This allows storage and display of values different from the current
7691
+ <varname>TimeZone</varname> setting. The third example converts
7692
+ Tokyo time to Chicago time. Converting <emphasis>time</emphasis>
7693
+ values to other time zones uses the currently active time zone rules
7694
+ since no date is supplied.
7685
7695
</para>
7686
7696
7687
7697
<para>
0 commit comments