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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux