Get Elapsed Hours between 2 Dates

For PostgreSQL:

SELECT
    jam.days,
    jam.hours,
    jam.minutes,
    jam.seconds,
    ((to_number(jam.days, 9999)*24) + to_number(jam.hours, 9999) ||':'|| to_number(jam.minutes, 9999) )as jumlah
from
 (SELECT
    to_char(age(date1 ,date2), 'DD') as days,
    to_char(age(date1 ,date2), 'HH24') as hours,
    to_char(age(date1 ,date2), 'MI') as minutes,
    to_char(age(date1 ,date2), 'SS') as seconds
  FROM
    table_name ) as jam


Similar Posts:

    None Found

Bookmark:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • description
  • LinkedIn
  • Slashdot
  • Technorati
  • TwitThis
  • Yahoo! Buzz

Leave a comment

Your comment

Spam Protection by WP-SpamFree