the6campbells writes:
> Why is Postgres returning a timestamp instead of the expected date data type
> for the first expression (the second returns a date)?
> select date '2001-03-30' - interval '1' year, date '2001-03-30' - integer
> '365' from tversion
Would you expect a date for
date
It works great, very nice method :-)
thanks a lot!
MK
---(end of broadcast)---
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
In article <[EMAIL PROTECTED]>,
Bruce Momjian writes:
> Magdalena Komorowska wrote:
>> Hi,
>> I hale a problem with counting interwal and I can't find what to do with
>> this.
>> I have two fields in the table:
>> Column | Type | Modifiers
>> -+-+---
>> d
On Tue, Dec 06, 2005 at 11:54:05AM -0500, Bruce Momjian wrote:
> test=> SELECT current_timestamp + cast(x || ' months' AS INTERVAL) FROM
> test;
>?column?
> ---
> 2006-03-06 11:53:05.574279-05
> (1 row)
Or another way:
test=> CREATE TABLE test (x numeric);
Magdalena Komorowska wrote:
> Hi,
> I hale a problem with counting interwal and I can't find what to do with
> this.
> I have two fields in the table:
> Column | Type | Modifiers
> -+-+---
> date_in | date|
> interwal_months | numeric |
>
I'm looking for a way, within SQL, given a starting date and an ending
date, to get back the number of months between the start and end date.
If I "SELECT end_date - start_date", I get back an interval in days; I
need months.
Thanks for any suggestions,
Brian
---(end o
On Friday 26 September 2003 09:18, you wrote:
> I am looking for a way to convert an interval into a number of days (
> integer);
>
> In sybase I would use :
>
> days(today()-r_expire)
SELECT now()::DATE - '1900-12-10'::DATE;
?column?
375
I am looking for a way to convert an interval into a number of days (
integer);
In sybase I would use :
days(today()-r_expire)
where r_expire is the timestamp I am comparing against.
How do we do this in postgres?
date_trunc(today()-r_expire) does not seem to do it
select extract(epoch f