Add information regarding date and time types and functions,

including arguments allowed.
This commit is contained in:
Thomas G. Lockhart 1997-07-02 14:13:14 +00:00
parent 54c38a95ee
commit 75ebaa748e
1 changed files with 60 additions and 51 deletions

View File

@ -1,6 +1,6 @@
.\" This is -*-nroff-*- .\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here.... .\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/built-in.3,v 1.7 1997/05/16 07:13:46 thomas Exp $ .\" $Header: /cvsroot/pgsql/src/man/Attic/built-in.3,v 1.8 1997/07/02 14:13:14 thomas Exp $
.TH BUILT-INS INTRO 04/01/97 PostgreSQL PostgreSQL .TH BUILT-INS INTRO 04/01/97 PostgreSQL PostgreSQL
.SH "DESCRIPTION" .SH "DESCRIPTION"
This section describes the data types, functions and operators This section describes the data types, functions and operators
@ -82,7 +82,11 @@ several possibilities for formats, such as date and time types.
Some date and time types share code for data input. For those types (currently Some date and time types share code for data input. For those types (currently
.IR datetime .IR datetime
and and
.IR abstime ) .IR abstime
, and
.IR timespan
and
.IR reltime )
the input can have any of a wide variety of styles. For numeric date representations, the input can have any of a wide variety of styles. For numeric date representations,
European and US conventions can differ, and the proper interpretation is obtained European and US conventions can differ, and the proper interpretation is obtained
by using the by using the
@ -129,22 +133,22 @@ offsets to GMT (e.g. "-08" or "-08:00" when in Pacific Standard Time).
Dates are stored internally in Greenwich Mean Time. Input and output routines Dates are stored internally in Greenwich Mean Time. Input and output routines
translate time to the local time zone of the server. translate time to the local time zone of the server.
.PP .PP
All special values allowed for The special values `current',
.IR "absolute time" `infinity' and `-infinity' are provided.
are also allowed for `infinity' specifies a time later than any valid time, and
.IR "datetime". `-infinity' specifies a time earlier than any valid time.
The special values \*(lqcurrent\*(rq, `current' indicates that the current time should be
\*(lqinfinity\*(rq and \*(lq-infinity\*(rq are provided.
\*(lqinfinity\*(rq specifies a time later than any valid time, and
\*(lq-infinity\*(rq specifies a time earlier than any valid time.
\*(lqcurrent\*(rq indicates that the current time should be
substituted whenever this value appears in a computation. substituted whenever this value appears in a computation.
.PP .PP
The strings \*(lqnow\*(rq and \*(lqepoch\*(rq can be used to specify The strings
time values. \*(lqnow\*(rq means the current time, and differs from `now',
\*(lqcurrent\*(rq in that the current time is immediately substituted `today',
for it. \*(lqepoch\*(rq means Jan 1 00:00:00 1970 GMT. `yesterday',
`tomorrow',
and `epoch' can be used to specify
time values. `now' means the current time, and differs from
`current' in that the current time is immediately substituted
for it. `epoch' means Jan 1 00:00:00 1970 GMT.
.SH "TIMESPAN" .SH "TIMESPAN"
General-use time span is input using a wide range of General-use time span is input using a wide range of
@ -165,10 +169,10 @@ Time span is specified with the following syntax:
@ Quantity Unit [Direction] @ Quantity Unit [Direction]
.sp .sp
where where
Quantity is ..., '-1', '0', `1', `2', ... Quantity is ..., `-1', `0', `1', `2', ...
Unit is `second', `minute', `hour', `day', `week', `month', `year', Unit is `second', `minute', `hour', `day', `week', `month', `year',
or abbreviations or plurals of these units. or abbreviations or plurals of these units.
Direction is ``ago'' Direction is `ago'.
.fi .fi
.SH "ABSOLUTE TIME" .SH "ABSOLUTE TIME"
Absolute time (abstime) is a limited-range (+/- 68 years) and limited-precision (1 sec) Absolute time (abstime) is a limited-range (+/- 68 years) and limited-precision (1 sec)
@ -196,17 +200,10 @@ Valid dates are from Dec 13 20:45:53 1901 GMT to Jan 19 03:14:04
using Greenwich Mean Time; the input and output routines default to using Greenwich Mean Time; the input and output routines default to
the local time zone. the local time zone.
.PP .PP
The special absolute time values \*(lqcurrent\*(rq, All special values allowed for
\*(lqinfinity\*(rq and \*(lq-infinity\*(rq are also provided. .IR "datetime"
\*(lqinfinity\*(rq specifies a time later than any valid time, and are also allowed for
\*(lq-infinity\*(rq specifies a time earlier than any valid time. .IR "absolute time".
\*(lqcurrent\*(rq indicates that the current time should be
substituted whenever this value appears in a computation.
.PP
The strings \*(lqnow\*(rq and \*(lqepoch\*(rq can be used to specify
time values. \*(lqnow\*(rq means the current time, and differs from
\*(lqcurrent\*(rq in that the current time is immediately substituted
for it. \*(lqepoch\*(rq means Jan 1 00:00:00 1970 GMT.
.SH "RELATIVE TIME" .SH "RELATIVE TIME"
Relative time (reltime) is a limited-range (+/- 68 years) and limited-precision (1 sec) Relative time (reltime) is a limited-range (+/- 68 years) and limited-precision (1 sec)
@ -506,6 +503,16 @@ tinterval
.SH "FUNCTIONS" .SH "FUNCTIONS"
Many data types have functions available for conversion to other related types. Many data types have functions available for conversion to other related types.
In addition, there are some type-specific functions. In addition, there are some type-specific functions.
.PP
For the
date_part() and date_trunc()
functions, arguments can be
`year', `month', `day', `hour', `minute', and `second',
as well as the more specialized quantities
`decade', `century', `millenium', `millisecond', and `microsecond'.
date_part() also allows
`dow'
to return day of week and `epoch' to return seconds since 1970.
.nf .nf
Functions: Functions:
@ -521,6 +528,7 @@ date
datetime datetime
abstime abstime(datetime) convert to abstime abstime abstime(datetime) convert to abstime
float8 date_part(text,datetime) specified portion of date field float8 date_part(text,datetime) specified portion of date field
datetime date_trunc(text,datetime) truncate date at specified units
bool isfinite(datetime) TRUE if this is a finite time bool isfinite(datetime) TRUE if this is a finite time
reltime reltime
@ -550,6 +558,7 @@ circle
float8 diameter(circle) diameter of circle float8 diameter(circle) diameter of circle
float8 area(circle) area of circle float8 area(circle) area of circle
.fi .fi
.SH "BINARY OPERATORS" .SH "BINARY OPERATORS"
This list was generated from the Postgres system catalogs with the This list was generated from the Postgres system catalogs with the
query: query: