[clug-progsig] Postgres: Unix timestamp -> date

Nick Wiltshire nick at customdesigns.ca
Tue Mar 21 00:15:28 PST 2006


On Tuesday 21 March 2006 1:05 am, Sol Mumey wrote:
> >From pg to unix ts:
>
> select extract(epoch from your_timestamp);
>
> To pg from unix_ts:
>
> select 'epoch'::timestamp with time zone + your_ts * '1 second'::interval
>
> I hope this works...don't have postgres installed at the moment.

bullseye. I knew there had to be an easy way. I take it :: is a cast operator? 
Learn something every day.

Thanks!
Nick



More information about the clug-progsig mailing list