@@ -7431,10 +7431,11 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
7431
7431
</indexterm>
7432
7432
7433
7433
<para>
7434
- The <literal>AT TIME ZONE</literal> construct allows conversions
7435
- of time stamps to different time zones. <xref
7436
- linkend="functions-datetime-zoneconvert-table"> shows its
7437
- variants.
7434
+ The <literal>AT TIME ZONE</literal> converts time
7435
+ stamp <emphasis>without time zone</emphasis> to/from
7436
+ time stamp <emphasis>with time zone</emphasis>, and
7437
+ <emphasis>time</emphasis> values to different time zones. <xref
7438
+ linkend="functions-datetime-zoneconvert-table"> shows its variants.
7438
7439
</para>
7439
7440
7440
7441
<table id="functions-datetime-zoneconvert-table">
@@ -7479,24 +7480,33 @@ SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
7479
7480
7480
7481
<para>
7481
7482
In these expressions, the desired time zone <replaceable>zone</> can be
7482
- specified either as a text string (e.g., <literal>'PST '</literal>)
7483
+ specified either as a text string (e.g., <literal>'America/Los_Angeles '</literal>)
7483
7484
or as an interval (e.g., <literal>INTERVAL '-08:00'</literal>).
7484
7485
In the text case, a time zone name can be specified in any of the ways
7485
7486
described in <xref linkend="datatype-timezones">.
7486
7487
</para>
7487
7488
7488
7489
<para>
7489
- Examples (assuming the local time zone is <literal>PST8PDT</ >):
7490
+ Examples (assuming the local time zone is <literal>America/Los_Angeles</literal >):
7490
7491
<screen>
7491
- SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'MST ';
7492
+ SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'America/Denver ';
7492
7493
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 19:38:40-08</computeroutput>
7493
7494
7494
- SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'MST ';
7495
+ SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'America/Denver ';
7495
7496
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 18:38:40</computeroutput>
7497
+
7498
+ SELECT TIMESTAMP '2001-02-16 20:38:40-05' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE 'America/Chicago';
7499
+ <lineannotation>Result: </lineannotation><computeroutput>2001-02-16 05:38:40</computeroutput>
7496
7500
</screen>
7497
- The first example takes a time stamp without time zone and interprets it as MST time
7498
- (UTC-7), which is then converted to PST (UTC-8) for display. The second example takes
7499
- a time stamp specified in EST (UTC-5) and converts it to local time in MST (UTC-7).
7501
+ The first example adds a time zone to a value that lacks it, and
7502
+ displays the value using the current <varname>TimeZone</varname>
7503
+ setting. The second example shifts the time stamp with time zone value
7504
+ to the specified time zone, and returns the value without a time zone.
7505
+ This allows storage and display of values different from the current
7506
+ <varname>TimeZone</varname> setting. The third example converts
7507
+ Tokyo time to Chicago time. Converting <emphasis>time</emphasis>
7508
+ values to other time zones uses the currently active time zone rules
7509
+ since no date is supplied.
7500
7510
</para>
7501
7511
7502
7512
<para>
0 commit comments