Re: How to display a unixtimestamp from a timestamp record?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Marcelo Bartsch <bartschm(at)psi(dot)com>
Cc: Postgres SQL list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: How to display a unixtimestamp from a timestamp record?
Date: 2001-01-15 17:41:06
Message-ID: Pine.BSF.4.21.0101150939380.16086-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


> select user_name, date_part( 'epoch' , timestamp 'acct_timestamp') from
> tbacct limit 2;
>
> it said ERROR: Bad timestamp external representation 'acct_timestamp'
> how should i represent date_part( 'epoch' , timestamp 'acct_timestamp')
> to work?

select user_name, date_part ('epoch', acct_timestamp) from tbacct limit 2;
should work... the single quotes are making a literal string value, so
your query is saying take the epoch of the timestamp represented by the
literal 'acct_timestamp' rather than the value of the field.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chad McKay 2001-01-15 17:44:59 Sort by relevance
Previous Message Tom Samplonius 2001-01-15 16:37:23 Re: improve performance