Re: Minutes and Seconds

From: Kurt Laugesen <kula_at_int.tele.dk>
Date: 1 Jun 2002 02:56:07 -0700
Message-ID: <7c804feb.0206010156.2109a91_at_posting.google.com>


If you are interested in the difference only this will give you the difference in seconds:

select to_number(to_char(date2,'sssss')) - to_number(to_char(date1,'sssss')) ;

'sssss' is the format mask for 'seconds after midnight' If you are running 9i there are new functions for extracting hours and minutes from the date-format.

Another possibility is to use dbms_utility.get_time if you are only concerned about measuring elapsed time
Regards
Kurt

"Larry" <schiffer52_at_attbi.com> wrote in message news:<q_UJ8.29582$0A2.24842_at_rwcrnsc54>...
> Hi All... any help is greatly appreciated...
>
> I'd like to return the number of minutes and seconds when subtracting one
> date from another (both dates will be the same date..just the hours, minutes
> and seconds will be different)
>
> I've tried using the round function, to_date, to_char in various
> comnbinations, with no luck..
>
> this is the closet I've come...any one have any suggestions?
>
> I thought I could use the round function with a format mask of 'mi' ..but it
> returns 'invalid column:
>
> Many thanks for the help.
>
> select round(to_date('31-MAY-2002 23:59:00','DD-MON-YYYY HH24:MI:SS') -
> TO_dATE
> ('31-MAY-2002 21:59:00','DD-MON-YYYY HH24:MI:SS'),'mi') FROM DUAL
Received on Sat Jun 01 2002 - 11:56:07 CEST

Original text of this message