Re: Trouble with UNIX TimeStamps

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Trouble with UNIX TimeStamps
Date: 2002-12-27 16:08:53
Message-ID: 20021227100853.E29164@serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> Sent: Friday, December 27, 2002 9:38 AM
>
> One way to do this is:
> area=> select to_char('epoch'::timestamp + (1040999196 || '
> seconds')::interval,'Day');
> to_char
> -----------
> Friday
> (1 row)

On Fri, Dec 27, 2002 at 09:58:14AM -0500, Jonathan Chum wrote:
> Sorry, I'm still to new with using functions within PostGreSQL, but . . .
> SELECT to_char((1040999196 || ' seconds')::interval +
> ticket_starters.ticket_time_start::timestamp ,'Day') FROM ticket_starters;
>
> and it returned back:
>
> ERROR: Cannot cast type integer to timestamp without time zone
>
> In my table, the column, ticket_time_start has a INTEGER value of
> '1009462540' which is today's date.
>
> How'd would I construct the query to pull from the db?

SELECT
to_char('epoch'::timestamp +
(a_table.unix_seconds_field || ' seconds')::interval,
'Day')
WHERE
some.condition > particular.thingie
;

i think...

--
"We will fight them on the beaches, we will fight them on the
sons of beaches" -- Miguel Churchill, Winston's bastard Mexican
brother.
--lifted from http://www.astray.com/acmemail/stable/documentation.xml


will(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2002-12-27 16:18:11 Re: Trouble with UNIX TimeStamps
Previous Message Dan Langille 2002-12-27 15:59:10 Re: PostgreSQL article