Re: Age function
От | Berend Tober |
---|---|
Тема | Re: Age function |
Дата | |
Msg-id | 446B3216.30209@seaworthysys.com обсуждение исходный текст |
Ответ на | Age function (Alban Hertroys <alban@magproductions.nl>) |
Ответы |
Re: Age function
|
Список | pgsql-general |
Alban Hertroys wrote: > Look here: > > template1=> select age(now() + '01:30:00'::interval); > age > ------------------ > -17:02:41.247957 > (1 row) > > So, One and a half hour in the future is actually 17 days ago? > Interesting... Either I am doing something wrong, or postgres is, I have > my suspicions ;) <good-natured sarcasm>Your suspicions are correct that you are doing, or rather, understanding something incorrectly. </good-natured sarcasm> First of all, the "17" is hours, not days. Look again at the formatted output. Secondly, there are two forms of AGE, taking, respectively two arguments and one argument. The latter is a shorthand for the former, assuming the current time as the base time. So in your query is equivalent to ('2006-05-17 00:00:00') - ('2006-05-17 10:02:01.727674-04' + '01:30:00') (my current time, 10:02:01.727674-04, is different from what yours was, obviously) Looking that the output from : select age(now() + '01:30:00'::interval), now(), current_date::timestamp, current_time, age(current_date, now() + '01:30:00'::interval), age(now() + '01:30:00'::interval, current_date), age(now() + '01:30:00'::interval, now()) might help, <professorial pontification>as would RTFM ("http://www.postgresql.org/docs/8.1/static/functions-datetime.html", Table 9-26. Date/Time Functions). </professorial pontification> Regards, Berend Tober
Вложения
В списке pgsql-general по дате отправления: