Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7968201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:02:25+00:00 2026-06-04T07:02:25+00:00

Using postgresql 9.1 with linux psql console and the windows pgadminIII the query: select

  • 0

Using postgresql 9.1 with linux psql console and the windows pgadminIII the query:

select '2012-05-05 15:57:31-07'::timestamp with time zone - '2012-05-01 23:13:34-07'::timestamp with time zone;

renders the return as:

    ?column?     
-----------------
 3 days 16:43:57
(1 row)

However, the windows JDBC driver (specifically using jasperreport’s ireport) renders this same query as:

    ?column?     
-----------------
 0 years 0 mons 3 days 16 hours 43 mins 57.00 secs
(1 row)

I’ve explored to_char and the postgresql documentation but cannot find a solution. Two questions: First, how can I make the JDBC driver render the interval with the same formatting as pqsl?

Second, can I instead make both psql and JDBC render the result as:

88:43:57  

where hours keep counting into the 100s as the interval grows (its a silly industry standard…)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:02:26+00:00Added an answer on June 4, 2026 at 7:02 am

    I made myself a function that does what I need. I’m all ears for suggestions, improvements, and optimizations.

    create or replace function format_hours(started timestamp with time zone, stopped timestamp with time zone)
    returns text as $$
    declare
            epoch_interval integer := extract(epoch from stopped - started);
            hours integer   := floor(epoch_interval/3600);
            minutes integer := floor((epoch_interval-hours*3600)/60);
            seconds integer := floor((epoch_interval-hours*3600-minutes*60));
    begin
          return hours::text || ':' ||
                 to_char(minutes, 'FM00') || ':' ||
                 to_char(seconds, 'FM00');
    end;
    $$ language plpgsql;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using PostgreSQL 8.4, I'm trying to put together the following query: SELECT (field_a +
I am using PostgreSQL 9.1.3 (PostgreSQL 9.1.3 on x86_64-pc-linux-gnu, compiled by gcc-4.6.real (Ubuntu/Linaro 4.6.1-9ubuntu3)
I'm using postgresql 8.4 and am having a bit of a problem granting select
I'm using PostgreSQL with CodeIgniter and I'm with some problems getting this query to
I am using Postgresql 8.3 and have the following simple function that will return
Right now we are using PostgreSQL 8.3 (on Linux) as a database backend to
Using PostgreSQL triggers, is it possible to record the changes that have happened to
Since I'm using Postgresql and can't use LINQ to SQL, I wrote my own
I'm using PostgreSQL 9.1 and I have this data structure: A B ------- 1
I'm using PostgreSQL 9.1.13 Here is what I've done so far: /* First Array

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.