Re: Determining period between 2 dates
От | Kevin Grittner |
---|---|
Тема | Re: Determining period between 2 dates |
Дата | |
Msg-id | 4D5BA8A0020000250003AB17@gw.wicourts.gov обсуждение исходный текст |
Ответ на | Re: Determining period between 2 dates (Thom Brown <thom@linux.com>) |
Список | pgsql-hackers |
Thom Brown <thom@linux.com> wrote: > For the number of fortnights, that becomes: > > select extract(epoch from now() - '2010-01-01 > 11:45:13'::timestamp)/60/60/24/14; > > You'd think with PostgreSQL having such a rich type system, it > wouldn't need to come to that. It's just asking for the number of > intervals between 2 timestamps rather than the number of seconds > and dividing it to the point you get your answer. The SQL standard has syntax to support getting that in YEAR, MONTH, DAY, HOUR, MINUTE, or SECOND (with the ability to specify decimal positions for SECOND). Nothing in there about fortnights, however. <left paren> <datetime value expression> <minus sign><datetime term> <right paren> <interval qualifier> I seem to remember previous discussions where people have resisted implementing this part of the standard, although I can't remember the reason. I'll probably be reminded soon... :-) -Kevin
В списке pgsql-hackers по дате отправления: