From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alex Mayrhofer <axelm(at)nona(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: timestamp <-> ctime conversion question... |
Date: | 2005-12-13 17:49:10 |
Message-ID: | 8305.1134496150@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Alex Mayrhofer <axelm(at)nona(dot)net> writes:
> i'm trying to convert time stamps to "seconds since epoch" and back.
> test=# SELECT (TIMESTAMP WITH TIME ZONE 'epoch'
> + 0 * INTERVAL '1 second') AT TIME ZONE 'UTC';
You're overthinking the problem. It should be just
SELECT (TIMESTAMP WITH TIME ZONE 'epoch' + n * INTERVAL '1 second')
There is a built-in function to_timestamp() equivalent to this in 8.1,
though it doesn't seem to have made it into the documentation :-(
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-12-13 17:58:22 | Re: Memory Leakage Problem |
Previous Message | Stephan Szabo | 2005-12-13 17:49:08 | Re: Bug#342369: PostgreSQL 8.1.0 RHEL / Debian incompatible |