Re: How to display a unixtimestamp from a timestamp record? - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: How to display a unixtimestamp from a timestamp record?
Date
Msg-id Pine.BSF.4.21.0101150939380.16086-100000@megazone23.bigpanda.com
Whole thread Raw
In response to How to display a unixtimestamp from a timestamp record?  (Marcelo Bartsch <bartschm@psi.com>)
List 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.



pgsql-sql by date:

Previous
From: Marcelo Bartsch
Date:
Subject: How to display a unixtimestamp from a timestamp record?
Next
From: "Chad McKay"
Date:
Subject: Sort by relevance