Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

8.2.1 to_char(negative interval,'HH24:MI') bug?



select age('2007-01-01 03:00','2007-01-01 04:59');
    age
-----------
 -01:59:00
(1 row)

select to_char(age('2007-01-01 03:00','2007-01-01 04:59'),'HH24:MI');
 to_char
---------
 -1:-59
(1 row)


Isn't just one '-' enough?  This leads to a problem here:


select '2007-01-03 06:00'::timestamp + age('2007-01-01 03:00','2007-01-01 04:59');
      ?column?
---------------------
 2007-01-03 04:01:00
(1 row)


select '2007-01-03 06:00'::timestamp + to_char(age('2007-01-01 03:00','2007-01-01 04:59'),'HH24:MI')::interval;
      ?column?
---------------------
 2007-01-03 05:00:00
(1 row)




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group