Re: Unixtime function?...
От | Roberto Mello |
---|---|
Тема | Re: Unixtime function?... |
Дата | |
Msg-id | 20010502141107.A19986@cc.usu.edu обсуждение исходный текст |
Ответ на | Unixtime function?... (Richard Whittaker <richard@connections.yk.ca>) |
Список | pgsql-php |
On Wed, May 02, 2001 at 08:49:32AM -0700, Richard Whittaker wrote: > Greetings: > > In MySQL there is a function to convert an arbitrary date/time combination > to a Unix timestamp, which makes it really easy to perform calculations in > PHP, since the result was always an integer... Is there a similar function > out there for PostgresSQL or PHP?... Some RTFM'ing comes in handy :) I put "time" in php.net and it returned me the time function manual. PostgreSQL has lots of functions to work with dates and times, including to_char and to_date, with tons of functionality. In PG (and Oracle) dates _are_ integers, even though it's not displayed to you as such: hgcm-test=# select now(); now ------------------------ 2001-05-02 14:08:40-06 hgcm-test=# select now() + 3; ?column? ------------ 2001-05-05 hgcm-test=# select now() - 3; ?column? ------------ 2001-04-29 Or you could use intervals: hgcm-test=# select now() + '1 week'::interval; ?column? ------------------------ 2001-05-09 14:10:18-06 There's more information in the PostgreSQL documentation. -Roberto -- +----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+ Roberto Mello - Computer Science, USU - http://www.brasileiro.net http://www.sdl.usu.edu - Space Dynamics Lab, Developer "Windows? What Windows? I use OS/2." (Bill Gates) ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly
В списке pgsql-php по дате отправления: