pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How do I convert an integet to a timestamp?
3+ messages / 3 participants
[nested] [flat]

* How do I convert an integet to a timestamp?
@ 2005-09-12 18:01  Wei <wengwei@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Wei @ 2005-09-12 18:01 UTC (permalink / raw)
  To: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How do I convert an integet to a timestamp?
@ 2005-09-13 04:53  Michael Fuhr <mike@fuhr.org>
  parent: Wei <wengwei@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Michael Fuhr @ 2005-09-13 04:53 UTC (permalink / raw)
  To: Wei <wengwei@gmail.com>; +Cc: 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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How do I convert an integet to a timestamp?
@ 2005-09-13 08:45  Eugene E. <sad@bankir.ru>
  parent: Wei <wengwei@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Eugene E. @ 2005-09-13 08:45 UTC (permalink / raw)
  To: Wei <wengwei@gmail.com>; +Cc: pgsql-sql

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;



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-09-13 08:45 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-09-12 18:01 How do I convert an integet to a timestamp? Wei <wengwei@gmail.com>
2005-09-13 04:53 ` Michael Fuhr <mike@fuhr.org>
2005-09-13 08:45 ` Eugene E. <sad@bankir.ru>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox