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: (view raw, whole thread or download thread mbox)
Lists: pgsql-ru-general
 Kovalenko Oleg wrote:
> Как в plpgsql преобразовать значение типа interval в integer (выражение 
> возвращает колличество дней, а мне нужно выдернуть это количество)
Там же сразу в 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-2017 The PostgreSQL Global Development Group