RE: [GENERAL] Epoch Time, conversion?

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

RE: [GENERAL] Epoch Time, conversion?

От:
"Jackson, DeJuan" <djackson@cpsgroup.com>
Дата:
> Is there any facility to convert "Epoch time <-> DATE" as that would
> be
> rather useful.....
> 
> James (james@linuxrocks.co.uk)
> Vortex Internet
> My Windows unders~1 long filena~1, and yours?
> 
Assuming v6.4 with plpgsql...
How's this:
create function epoch2dtm(float8) returns datetime AS '
 declare
   myepoch alias for $1;
 begin
    return (now() - 
 (date_part(''epoch'', now()::datetime)::int4 || '' seconds'')::timespan
+ 
 (myepoch::int4 || '' seconds'')::timespan)::datetime;
 end;' language 'plpgsql';
FAQ