Thread: timestamp conversion to unisgned long?

timestamp conversion to unisgned long?

From
pierre@kahuna.versions.com
Date:
All,
  Perhaps I'm not sing hte correct datatype, but I'd like to be able to convert
a timestamp over to an unsigned long to be used within C code and compare
to the output of time().

 I can't seem to see any easy way of doing this using the built in
stuff for postgresql.

  Ideas?

  Perhaps I'm using the wrong type?

 Pierre

Re: timestamp conversion to unisgned long?

From
Alex Pilosov
Date:
You probably want to use
select date_part('epoch', timeval);


On 22 Jun 2001 pierre@kahuna.versions.com wrote:

> All,
>   Perhaps I'm not sing hte correct datatype, but I'd like to be able to convert 
> a timestamp over to an unsigned long to be used within C code and compare
> to the output of time().
> 
>  I can't seem to see any easy way of doing this using the built in
> stuff for postgresql.
> 
>   Ideas?
> 
>   Perhaps I'm using the wrong type?
> 
>  Pierre
> 
> 



Re: timestamp conversion to unisgned long?

From
Peter Eisentraut
Date:
pierre@kahuna.versions.com writes:

>   Perhaps I'm not sing hte correct datatype, but I'd like to be able to convert
> a timestamp over to an unsigned long to be used within C code and compare
> to the output of time().

extract(epoch from your_value_here)

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter