Thread: How do I convert an integet to a timestamp?

How do I convert an integet to a timestamp?

From
"Wei"
Date:
Hi.

I followed the doc and tried "select CAST(1126547334 AS timestamp)" and
I only got an error response that says: ERROR:  cannot cast type
integer to timestamp without time zone.

What is the proper way to do the conversion?

Thanks

Wei



Re: How do I convert an integet to a timestamp?

From
Michael Fuhr
Date:
On Mon, Sep 12, 2005 at 11:01:08AM -0700, Wei wrote:
> I followed the doc and tried "select CAST(1126547334 AS timestamp)" and
> I only got an error response that says: ERROR:  cannot cast type
> integer to timestamp without time zone.

What documentation suggested casting an integer to a timestamp?

> What is the proper way to do the conversion?

See "Date/Time Functions and Operators" -- it has an example of what
you're trying to do:

http://www.postgresql.org/docs/8.0/interactive/functions-datetime.html

-- 
Michael Fuhr


Re: How do I convert an integet to a timestamp?

From
"Eugene E."
Date:
Wei wrote:
> Hi.
> 
> I followed the doc and tried "select CAST(1126547334 AS timestamp)" and
> I only got an error response that says: ERROR:  cannot cast type
> integer to timestamp without time zone.
> 
> What is the proper way to do the conversion?

select 123456789::abstime::timestamp;