Time difference function ?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Time difference function ?

  1. #1
    Join Date
    Sep 2002
    Posts
    376

    Time difference function ?

    Hi,
    Is there any in built function which will give me The diffence between two specified times ?
    For example i want difference between
    (Mon Sep 1 00:00:05 2003) and (Mon Sep 1 05:45:04 2003)

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Yes, there is. Although it is technicaly implemented as a function, it is ususally not considered a true function, but rather an operator. It is called "MINUS" (has nothing in common with MINUS "SET OPERATOR")or "SUBTRACTION" in spoken language, it's simbol is "-". It is used both in NUMBER as well as in DATE arythmetics.

    To get the time difference between two dates, simply use it like this:

    SELECT :date2 - :date1 FROM dual;

    You'll get time difference, expressed in days.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #3
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    I frequently use to find the process run time by executing the following query:
    select prcsinstance seq,
    prcstype, prcsname,
    begindttm, enddttm,
    runstatus sta,
    trunc((enddttm - begindttm)*24) HH,
    (trunc((enddttm - begindttm)*24*60) - (trunc((enddttm - begindttm)*24)*60)) MM,
    (trunc((enddttm - begindttm)*24*60*60) - (trunc((enddttm - begindttm)*24*60))*60) SS
    from tablex;

    This may also help you.

    Tamil

Posting Permissions

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


Click Here to Expand Forum to Full Width