Re: how to get a number of seconds in some interval ?

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Shane Ambler" <pgsql(at)sheeky(dot)biz>
Cc: "Achilleas Mantzios" <achill(at)matrix(dot)gatewaynet(dot)com>, pgsql-admin(at)postgresql(dot)org, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Julius Tuskenis" <julius(at)nsoft(dot)lt>
Subject: Re: how to get a number of seconds in some interval ?
Date: 2008-05-13 08:48:32
Message-ID: dcc563d10805130148r4d24fe94s18e71921d6bd121a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, May 13, 2008 at 2:42 AM, Shane Ambler <pgsql(at)sheeky(dot)biz> wrote:
> Scott Marlowe wrote:
>
>> True. But that's only because it doesn't have a date to work against.
>> If you run:
>>
>> select '2007-02-01 12:00:00'::timestamp + '1 month'::interval;
>> you get: 2007-03-01 12:00:00
>>
>> If you run:
>> select '2007-03-01 12:00:00'::timestamp + '1 month'::interval;
>> you get: 2007-04-01 12:00:00
>>
>> Then, if we run:
>> select ('2007-03-01 12:00:00'::timestamp + '1 month'::interval) -
>> '2007-03-01 12:00:00'::timestamp;
>> we get: 31 days
>>
>> But if we run:
>> select ('2007-02-01 12:00:00'::timestamp + '1 month'::interval) -
>> '2007-02-01 12:00:00'::timestamp;
>> we get: 28 days
>>
>> So, I'm not sure how many days a month has.
>
> Try looking at a calendar.;-)

Sorry, didn't realize I'd need to explain my joke. Thought it was
pretty obvious. Next time I'll throw a smiley in there.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Travis Smith 2008-05-13 13:45:19 EDB database link to Oracle
Previous Message Shane Ambler 2008-05-13 08:42:41 Re: how to get a number of seconds in some interval ?