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

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Wei <wengwei(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How do I convert an integet to a timestamp?
Date: 2005-09-13 04:53:07
Message-ID: 20050913045307.GA98267@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2005-09-13 04:58:55 Re: user defined type, plpgsql function and NULL
Previous Message Greg Sabino Mullane 2005-09-13 00:38:49 Re: Need help with `unique parents` constraint