conversion from epoch

Поиск
Список
Период
Сортировка
Искать

conversion from epoch

От:
"Little, Douglas" <DOUGLAS.LITTLE@orbitz.com>
Дата:
Вложения:

I have an input source that is in epoch time.    Is there a built-in conversion to changing to timestamp

 

Thanks

 

 

Doug Little

 

Sr. Data Warehouse Architect | Business Intelligence Architecture | Orbitz Worldwide

500 W. Madison, Suite 1000  Chicago IL 60661| Office 312.260.2588 | Fax 312.894.5164 | Cell 847-997-5741

Douglas.Little@orbitz.com

   orbitz.com | ebookers.com | hotelclub.com | cheaptickets.com | ratestogo.com | asiahotels.com

 

Re: conversion from epoch

От:
Andreas Kretschmer <andreas@a-kretschmer.de>
Дата:




"Little, Douglas"  hat am 30. Juli 2012 um 16:36
geschrieben:


> I have an input source that is in epoch time.    Is there a built-in
> conversion to changing to timestamp
> 
> 
> 
select 'epoch'::date +  * '1second'::interval;




Andreas

Re: conversion from epoch

От:
Steve Atkins <steve@blighty.com>
Дата:

On Jul 30, 2012, at 7:36 AM, Little, Douglas wrote:

> I have an input source that is in epoch time.    Is there a built-in conversion to changing to timestamp

to_timestamp().

You can also do things like "select timestamptz 'epoch' + ? * interval '1 second'".

Cheers,
  Steve

Re: conversion from epoch

От:
Adrian Klaver <adrian.klaver@gmail.com>
Дата:
On 07/30/2012 07:36 AM, Little, Douglas wrote:
> I have an input source that is in epoch time.    Is there a built-in
> conversion to changing to timestamp

http://www.postgresql.org/docs/9.1/interactive/functions-formatting.html
"
to_timestamp(double precision)	timestamp with time zone	convert Unix 
epoch to time stamp	to_timestamp(1284352323)
"

So:

test=> SELECT to_timestamp(extract(epoch from now()));
          to_timestamp
-------------------------------
  2012-07-30 15:51:42.587106-07


>
> Thanks
>
> *Doug Little*
>


-- 
Adrian Klaver
adrian.klaver@gmail.com
FAQ