+ Reply to Thread
Results 1 to 2 of 2

Thread: get the difference in hours between two dates

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    10

    get the difference in hours between two dates

    How to get the difference in hours between two dates ?
    Last edited by matrix; 11-12-2012 at 02:54 AM.

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    13
    We can get the difference in hours between two dates by that query :

    Code:
    select 24 * (sysdate - to_date('2012-02-28 15:20', 'YYYY-MM-DD hh24:mi')) as difference_hours
    from time_table;
    And if the formatting of the dates are wrong, you can possible use two steps like:
    Code:
    select 24 * (to_date(to_char(sysdate, 'YYYY-MM-DD hh24:mi'), 'YYYY-MM-DD hh24:mi') - to_date('2012-02-28 15:20', 'YYYY-MM-DD hh24:mi')) as difference_hours
    from time_table;

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts