AT TIME ZONE Variants
- 3">
+ 1">
|
- >Expression>
- Return Type
- <entry>Description</entry>
+ role="functableentry">
+ OperatorDescriptionExample(s)
+
|
-
- timestamp without time zone AT TIME ZONE zone
+
+ timestamp without time zone AT TIME ZONE zone
+ timestamp with time zone
+
+ Converts given time stamp without time zone to
+ time stamp with time zone, assuming the given
+ value is in the named time zone.
+
+ timestamp '2001-02-16 20:38:40' at time zone 'America/Denver'
+ 2001-02-17 03:38:40+00
- timestamp with time zone
- Treat given time stamp without time zone as located in the specified time zone
|
-
- timestamp with time zone AT TIME ZONE zone
+
+ timestamp with time zone AT TIME ZONE zone
+ timestamp without time zone
+
+ Converts given time stamp with time zone to
+ time stamp without time zone, as the time would
+ appear in that zone.
+
+ timestamp with time zone '2001-02-16 20:38:40-05' at time zone 'America/Denver'
+ 2001-02-16 18:38:40
- timestamp without time zone
- Convert given time stamp with time zone to the new time
- zone, with no time zone designation
|
-
- time with time zone AT TIME ZONE zone
+
+ time with time zone AT TIME ZONE zone
+ time with time zone
+
+ Converts given time with time zone to a new time
+ zone. Since no date is supplied, this uses the currently active UTC
+ offset for the named destination zone.
+
+ time with time zone '05:34:17-05' at time zone 'UTC'
+ 10:34:17+00
- time with time zone
- Convert given time with time zone to the new time zone
In these expressions, the desired time zone zone can be
- specified either as a text string (e.g., 'America/Los_Angeles')
+ specified either as a text value (e.g., 'America/Los_Angeles')
or as an interval (e.g., INTERVAL '-08:00').
In the text case, a time zone name can be specified in any of the ways
described in .
+ The interval case is only useful for zones that have fixed offsets from
+ UTC, so it is not very common in practice.
- Examples (assuming the local time zone is America/Los_Angeles):
+ Examples (assuming the current setting
+ is America/Los_Angeles):
SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'America/Denver';
Result: 2001-02-16 19:38:40-08
SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'America/Denver';
Result: 2001-02-16 18:38:40
-SELECT TIMESTAMP '2001-02-16 20:38:40-05' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE 'America/Chicago';
+SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'Asia/Tokyo' AT TIME ZONE 'America/Chicago';
Result: 2001-02-16 05:38:40
The first example adds a time zone to a value that lacks it, and
to the specified time zone, and returns the value without a time zone.
This allows storage and display of values different from the current
TimeZone setting. The third example converts
- Tokyo time to Chicago time. Converting time
- values to other time zones uses the currently active time zone rules
- since no date is supplied.
+ Tokyo time to Chicago time.
The following functions are available to delay execution of the server
process:
-pg_sleep(seconds)
-pg_sleep_for(interval)
-pg_sleep_until(timestamp with time zone)
+pg_sleep ( double precision )
+pg_sleep_for ( interval )
+pg_sleep_until ( timestamp with time zone )
pg_sleep makes the current session's process
- sleep until seconds seconds have
- elapsed. seconds is a value of type
- double precision, so fractional-second delays can be specified.
- pg_sleep_for is a convenience function for larger
- sleep times specified as an interval.
+ sleep until the given number of seconds have
+ elapsed. Fractional-second delays can be specified.
+ pg_sleep_for is a convenience function to
+ allow the sleep time to be specified as an interval.
pg_sleep_until is a convenience function for when
a specific wake-up time is desired.
For example: