From: | Thomas Lockhart <lockhart(at)fourpalms(dot)org> |
---|---|
To: | Ben-Nes Nimrod <nimrod(at)canaan(dot)co(dot)il> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: unix timestamp |
Date: | 2001-08-16 20:39:36 |
Message-ID: | 3B7C2F88.76ED8282@fourpalms.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> how can i use unix timestamp as a data type?
You don't want to. Really.
> i thought that the timestamp data type use the unix timestamp but
> found out that it didnt.. :(
Right. One second resolution and limited range was considered a problem.
> do i need to use an int data type for holding unix timestamp or there
> is a data type which was build specialy for that?
I would suggest using the native timestamp type. You can convert back
and forth using various techniques, but you should find that the
examples below give you a good start:
lockhart=# select date_part('epoch',timestamp 'now');
date_part
-----------
997993780
lockhart=# select timestamp(integer '997993780');
timestamp
------------------------
2001-08-16 20:29:40+00
hth
- Thomas
From | Date | Subject | |
---|---|---|---|
Next Message | Dr. Evil | 2001-08-16 20:41:10 | Re: Storing images in PG? |
Previous Message | Andrew Gould | 2001-08-16 20:20:45 | Killing inactive connections |