+ linkend="functions-datetime-current">.) Note however that these are
+ SQL functions and are not> recognized as data input strings.
+
+
interval output looks like the input format, except
that units like century or
- wek are converted to years and days and that
+ week are converted to years and days and
ago is converted to an appropriate sign. In
ISO mode the output looks like
- quantity> unit> ... > > days> > hours>:minutes>:sekunden>
+ quantity> unit> ... > > days> > hours>:minutes>:seconds>
Time zones, and time-zone conventions, are influenced by
political decisions, not just earth geometry. Time zones around the
world became somewhat standardized during the 1900's,
- but continue to be prone to arbitrary changes.
-
PostgreSQL uses your operating
- system's underlying features to provide output time-zone
- support, and these systems usually contain information for only
- the time period 1902 through 2038 (corresponding to the full
- range of conventional Unix system time).
- timestamp with time zone and time with time
- zone will use time zone
- information only within that year range, and assume that times
- outside that range are in
UTC.
- But since time zone support is derived from the underlying operating
- system time-zone capabilities, it can handle daylight-saving time
- and other special behavior.
+ but continue to be prone to arbitrary changes, particularly with
+ respect to daylight-savings rules.
+
PostgreSQL currently supports daylight-savings
+ rules over the time period 1902 through 2038 (corresponding to the full
+ range of conventional Unix system time). Times outside that range are
+ taken to be in standard time> for the selected time zone, no
+ matter what part of the year they fall in.
Although the date type
does not have an associated time zone, the
time type can.
- Time zones in the real world can have no meaning unless
- associated with a date as well as a time
+ Time zones in the real world have little meaning unless
+ associated with a date as well as a time,
since the offset may vary through the year with daylight-saving
time boundaries.
The default time zone is specified as a constant numeric offset
- from
UTC>. It is not possible to adapt to daylight-saving
- time when doing date/time arithmetic across
+ from
UTC>. It is therefore not possible to adapt to
+ daylight-saving time when doing date/time arithmetic across
recommend not using the type time with
time zone (though it is supported by
PostgreSQL for legacy applications and
- for comp
atibility with other SQL
-
implementations). PostgreSQL assumes
+ for comp
liance with the SQL standard).
your local time zone for any type containing only date or time.
- All dates and times are stored internally in
-
UTC. T
imes are converted to local time
- on the database server before being sent to the client,
- hence by default are in the server time zone.
+ All timezone-aware dates and times are stored internally in
+
UTC. T
hey are converted to local time
+ in the zone specified by the configuration
+ parameter before being displayed to the client.
- There are several ways to select the time zone used by the server:
+ The configuration parameter can
+ be set in the file postgresql.conf>, or in any of the
+ other standard ways described in .
+ There are also several special ways to set it:
- The TZ environment variable on the server host
- is used by the server as the default time zone, if no other is
- specified.
+ If timezone> is not specified in
+ postgresql.conf> nor as a postmaster command-line switch,
+ the server attempts to use the value of the TZ
+ environment variable as the default time zone. If TZ
+ is not defined or is not any of the time zone names known to
+
PostgreSQL, the server attempts to
+ determine the operating system's default time zone by checking the
+ behavior of the C library function localtime()>. The
+ default time zone is selected as the closest match among
+
PostgreSQL's known time zones.
- The configuration parameter can
- be set in the file postgresql.conf>.
+ The
SQL command
SET TIME ZONE
+ sets the time zone for the session. This is an alternative spelling
+ of SET TIMEZONE TO> with a more SQL-spec-compatible syntax.
command to the server upon connection.
-
-
- The
SQL command
SET TIME ZONE
- sets the time zone for the session.
-
-
-
- If an invalid time zone is specified, the time zone becomes
-
UTC (on most systems anyway).
-
-
-
Refer to for a list of
available time zones.