Re: Convert "epoch" to timestamp - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Convert "epoch" to timestamp
Date
Msg-id 20020423075313.W13153-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Convert "epoch" to timestamp  (Jeff Eckermann <jeff_eckermann@yahoo.com>)
List pgsql-general
On Tue, 23 Apr 2002, Jeff Eckermann wrote:

> 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

You'd need to double quote that timestamp to differentiate
the function from the data type: "timestamp"(1019571752)



pgsql-general by date:

Previous
From: Jeff Eckermann
Date:
Subject: Convert "epoch" to timestamp
Next
From: Thomas Lockhart
Date:
Subject: Re: Convert "epoch" to timestamp