Q: timestamp - timestamp

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

Q: timestamp - timestamp

От:
Sepp Rudel <sepprudel@yahoo.com>
Дата:
Hi,

this must be a no-brainer but I just can't get this
working: I'd like to substract one timestamp from
another and have the result as integer/seconds, e.g.:

2003-04-28 14:10:00+01 - 2003-04-28 14:00:00+01

would produce

600

Thanks in advance.

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

Re: Q: timestamp - timestamp

От:
Josh Berkus <josh@agliodbs.com>
Дата:
Sepp,

> this must be a no-brainer but I just can't get this
> working: I'd like to substract one timestamp from
> another and have the result as integer/seconds, e.g.:
> 
> 2003-04-28 14:10:00+01 - 2003-04-28 14:00:00+01

SELECT extract(epoch FROM '2003-04-28 14:10:00+01'::timestamptz) -  
extract(epoch FROM '2003-04-28 14:00:00+01'::timestamptz)

-- 
-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
                                        Josh Berkus
   Complete information technology 	josh@agliodbs.com
    and data management solutions 	(415) 565-7293
   for law firms, small businesses 	 fax 621-2533
    and non-profit organizations. 	San Francisco

FAQ