Skip site navigation (1) Skip section navigation (2)

Re: Преобр▓┬╪╛╛Щ|Л°R√ГFW'fб p integer

From: Mykola Dzham <i(at)levsha(dot)org(dot)ua>
To: Kovalenko Oleg <ok(at)calculate(dot)ru>
Cc: pgsql-ru-general(at)postgresql(dot)org
Subject: Re: Преобр▓┬╪╛╛Щ|Л°R√ГFW'fб p integer
Date: 2007-02-26 14:55:40
Message-ID: 20070226145540.GR31319@expo.ukrweb.net (view raw or flat)
Thread:
Lists: pgsql-ru-general
 Kovalenko Oleg wrote:
> Как в plpgsql преобразовать значение типа interval в integer (выражение 
> возвращает колличество дней, а мне нужно выдернуть это количество)

http://www.postgresql.org/docs/8.1/interactive/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
Там же сразу в User Comments:

The EXTRACT(EPOCH FROM INTERVAL ...) is a nice way to convert a
timestamp to an int, i.e.

  SELECT EXTRACT(EPOCH FROM INTERVAL '2 years 3 months') / (24*60*60)

will give the number of days in the interval (~821)

-- 
Mykola Dzham, LEFT-(UANIC|RIPE)
JID: levsha(at)jabber(dot)net(dot)ua

pgsql-ru-general by date

Next:From: Kovalenko OlegDate: 2007-02-26 15:12:30
Subject: Re: Преобразование interval в integer
Previous:From: Evgeny M. BaldinDate: 2007-02-19 09:20:18
Subject: История о PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group