Question:

Why do I get postgreSql interval results like this?

by  |  earlier

0 LIKES UnLike

Here is my basic statement; age(t.endtime, t.starttime) and it gives me results like "17 days 5629:19:11.335" instead of 251 days and however many hours and minutes...

Any ideas? Can I convert an INTERVAL to something else?

Thanks

 Tags:

   Report

1 ANSWERS


  1. You can extract any part of the date by the extract function.

    So if you want only days use:

    select extract(days from age( t.endtime, t.starttime) ) ;

    If you want to further process the result, then extract "epoch" from the age, that way you get the result converted to seconds.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions