On Jun 24, 2:46 am, Mayank <mayank.del...@gmail.com> wrote:
> Hi Experts,
>
> How to find the diffrence between two timestamp dates in days.
>
> e.q
>
> start_activity_date timestamp
> end_activity_date timestamp
>
> select (start_activity_date-end_activity_date )
> from table
>
> above query given result in interval day to second how can i get in
> days only.
>
> Regards
> Mayank
to get the days part of an interval you use the extract function
(http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/
functions42a.htm#1017163)
similar to
select extract( DAY from (start_activity_date-end_activity_date ))
from table
or, if you aren't married to the idea of using timestamps you could
just use the type date (which does include the time) and your original
query would indeed give you the number of days between the two dates.
I generally use date when I know I am going to do things like this
because I am old and crusty and always mangle extract the first time I
use it.
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---