On Tue, May 13, 2008 at 2:42 AM, Shane Ambler <pgsql@sheeky.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.