Re: how to get a number of seconds in some interval ?
От | Scott Marlowe |
---|---|
Тема | Re: how to get a number of seconds in some interval ? |
Дата | |
Msg-id | dcc563d10805130148r4d24fe94s18e71921d6bd121a@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: how to get a number of seconds in some interval ? (Shane Ambler <pgsql@Sheeky.Biz>) |
Список | pgsql-admin |
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.
В списке pgsql-admin по дате отправления: