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

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: How to display a unixtimestamp from a timestamp record?
Дата
Msg-id Pine.BSF.4.21.0101150939380.16086-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на How to display a unixtimestamp from a timestamp record?  (Marcelo Bartsch <bartschm@psi.com>)
Список 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 по дате отправления:

Предыдущее
От: Marcelo Bartsch
Дата:
Сообщение: How to display a unixtimestamp from a timestamp record?
Следующее
От: "Chad McKay"
Дата:
Сообщение: Sort by relevance