Convert "epoch" to timestamp
От | Jeff Eckermann |
---|---|
Тема | Convert "epoch" to timestamp |
Дата | |
Msg-id | 20020423143323.33105.qmail@web20801.mail.yahoo.com обсуждение исходный текст |
Ответы |
Re: Convert "epoch" to timestamp
Re: Convert "epoch" to timestamp |
Список | pgsql-general |
jeff=# select version(); version ------------------------------------------------------------------- PostgreSQL 7.2 on i386-portbld-freebsd4.5, compiled by GCC 2.95.3 (1 row) I need to convert the "epoch" (i.e. number of seconds) timestamp to a PostgreSQL timestamp. The extract/date_part functions do it easily the other way, but I have had some difficulty in doing what I need. According to posts in the archives, the following used to work: jeff=# select extract (epoch from current_timestamp(0)); date_part ------------ 1019571752 (1 row) jeff=# select timestamp(1019571752); ERROR: TIMESTAMP(1019571752) WITH TIME ZONE precision must be between 0 and 13 jeff=# I assume this change came with the other date/time changes in version 7.2. The following works: jeff=# select abstime(1019571752); abstime ------------------------ 2002-04-23 09:22:32-05 (1 row) Can I rely on this continuing to work? Apparently not, because the docs say (wrt "abstime" and "reltime"): "Any or all of these internal types might disappear in a future release." Is there another/better way? __________________________________________________ Do You Yahoo!? Yahoo! Games - play chess, backgammon, pool and more http://games.yahoo.com/
В списке pgsql-general по дате отправления: