diff options
author | Bruce Momjian <bruce@momjian.us> | 2005-06-09 16:35:09 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2005-06-09 16:35:09 +0000 |
commit | 4d0e7b4aace5cdad7137d6efe71bcad4015c2518 (patch) | |
tree | 00b6985a75fc5a729075cf1ca2c51012f232527d /doc/src | |
parent | 4a5cda7bba7c5aee9298f5bc3f287b299cdee634 (diff) |
Please find attached a patch (diff -c against cvs HEAD) to add a
function that accepts a double precision argument assumed to be a Unix
epoch timestamp and returns timestamp with time zone, and accompanying
documentation.
Usage:
test=# select to_timestamp(200120400);
to_timestamp
------------------------
1976-05-05 14:00:00+09
(1 row)
Michael Glaesemann
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 7eb2c4c6b13..bc34c96542c 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.252 2005/06/07 07:08:34 neilc Exp $ +$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.253 2005/06/09 16:35:08 momjian Exp $ PostgreSQL documentation --> @@ -4082,6 +4082,13 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})'); argument is the value to be formatted and the second argument is a template that defines the output or input format. </para> + <para> + The <function>to_timestamp</function> function can also take a single + <type>double precision</type> argument to convert from Unix epoch to + <type>timestamp with time zone</type>. + (<type>Integer</type> Unix epochs are implicitly cast to + <type>double precision</type>.) + </para> <table id="functions-formatting-table"> <title>Formatting Functions</title> @@ -4139,6 +4146,12 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})'); <entry><literal>to_timestamp('05 Dec 2000', 'DD Mon YYYY')</literal></entry> </row> <row> + <entry><literal><function>to_timestamp</function>(<type>double precision</type>)</literal></entry> + <entry><type>timestamp with time zone</type></entry> + <entry>convert UNIX epoch to time stamp</entry> + <entry><literal>to_timestamp(200120400)</literal></entry> + </row> + <row> <entry><literal><function>to_number</function>(<type>text</type>, <type>text</type>)</literal></entry> <entry><type>numeric</type></entry> <entry>convert string to numeric</entry> |