Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Posts
    102

    Unanswered: Need to find the duration

    Dear All,

    I need to find the duration between one time to another time

    SQL> create table test_time
    2 (st_dt date,
    3 ED_DT date);

    Table created.

    SQL> insert into test_time
    values(to_date('01-08-11 10:10','DD-MM-RR HH24:MI'),to_date('01-08-11 13:15','DD-MM-RR HH24:MI'));

    1 row created.

    SQL> commit;

    Commit complete.

    SQL> select to_char(ED_DT,'HH24:MI'),to_char(st_dt,'HH24:MI') from test_time;

    TO_CH TO_CH
    ----- -----
    13:15 10:10
    Now i need to find the difference.....

    Pls help me on this.
    Working Together...

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Subtract these values. The result will be number of DAYS (so you'll have to use a little bit of arithmetic to format it differently; you know, a day has 24 hours, an hour has 60 minutes, ...).

  3. #3
    Join Date
    Jul 2004
    Posts
    102
    Thanks Littlefoot from your Response.

    Pls pls pls give me a example on my data. it will be easier for me.
    Working Together...

  4. #4
    Join Date
    Jul 2004
    Posts
    102
    I got it

    SQL> SELECT (ED_DT - St_dt) * 24 * 60 difference_in_minutes FROM test_time;

    DIFFERENCE_IN_MINUTES
    ---------------------
    185

    Thanks Littlefoot for your Help
    Working Together...

Posting Permissions

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