'1 year' = '360 days' ????
От | Ricardo Perez Lopez |
---|---|
Тема | '1 year' = '360 days' ???? |
Дата | |
Msg-id | BAY15-F25yabYTHrdus00003972@hotmail.com обсуждение исходный текст |
Ответы |
Re: '1 year' = '360 days' ????
Re: '1 year' = '360 days' ???? |
Список | pgsql-general |
Hello everyone: I'm a PostgreSQL newbie, working now with dates, times, timestamps and intervals. I have three questions about the above: FIRST: -------- I have observed that, for PostgreSQL, one year is actually 360 days: SELECT '1 year'::timestamp = '360 days'::timestamp; ?column? ------------- t Glubs! I believed that 1 year is 365 days, or 366 if leap. Is it normal? SECOND: ----------- When I want to check how many time is between two dates, I have two options (which shows two different results): SELECT '30-09-04'::timestamp - '30-09-03'::timestamp, age('30-09-04'::timestamp, '30-09-03'::timestamp); ?column? | age ------------------------------- @ 366 days | @ 1 year The results are different. If we compare the two results: SELECT ('30-09-04'::timestamp - '30-09-03'::timestamp) = age('30-09-04'::timestamp, '30-09-03'::timestamp); ?column? -------------- f Obviously, it returns False, because I told in the first question, 1 year is 360 days for PostgreSQL. The question is: is it normal? Which of the two methods is the correct? To substract timestamps? Or to use the age function? THIRD: -------- As I told in the second question, when I do: SELECT '30-09-04'::timestamp - '30-09-03'::timestamp; the result is: ?column? -------------- @ 366 days The question is: is there any way to "normalize" the result, such that the result was: @ 1 year 1 day ? I think it's better (and more correct) "@ 1 year 1 day" rather than "@ 366 days". Is there any way to achieve that? Thanks to all. Ricardo. _________________________________________________________________ Horóscopo, tarot, numerología... Escucha lo que te dicen los astros. http://astrocentro.msn.es/
В списке pgsql-general по дате отправления: