Re: How to calculate time difference excluding weekends (saturday and sunday)

From: deepakp <deepak10000_at_hotmail.com>
Date: Wed, 30 Apr 2008 09:45:23 -0700 (PDT)
Message-ID: <90310eed-7575-4860-b52b-f9ed4a6357f8@y21g2000hsf.googlegroups.com>


On Apr 30, 9:29 am, Charles Hooper <hooperc2..._at_yahoo.com> wrote:
> On Apr 30, 9:49 am, deepakp <deepak10..._at_hotmail.com> wrote:
>
>
>
> > I have an Oracle table that has 2 Date fields..i.e. the data type -
> > DATE
>
> > Field 1: START_DATE sample value "2008-04-04 12:00:00";
> > Field 2: END_DATE sample value "2008-04-07 05:46:07";
>
> > If I subtract one date from another, I can get the time difference.
>
> > Round((END_DATE - START_DATE), 4) AS TOTAL_DAYS
>
> > The above results in 3.7404
>
> > Between 2008-04-04 and 2008-04-07, there is Saturday and Sunday which
> > are 2008-04-05 and 2008-04-06.
> > I would like them to be excluded.
>
> > Hence, the resultant that I'm looking for should be 1.7404 -- not
> > 3.7404
>
> > Is there a simple way to get the desired solution?
>
> > Thanks,
> > Deepak
>
> Have you tried a Google search of the Usenet archives, or even a
> regular Google search?http://groups.google.com/group/comp.databases.oracle.misc/browse_thre...http://groups.google.com/group/comp.databases.oracle.misc/browse_thre...http://www.google.com/search?hl=en&q=site%3Aasktom.oracle.com+weekend...
>
> Charles Hooper
> IT Manager/Oracle DBA
> K&M Machine-Fabricating, Inc.

Thank you for your response. I did search online and could not find any that showed time difference between. The examples I found were similar to the ones you pasted..which show count of days between 2 dates. That is not what I'm looking for. Instead, I'm looking for time difference excluding weekends. The closest match I found in online search was http://searchoracle.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid41_cid464601_tax294550,00.html

Kind Regards,
Deepak Received on Wed Apr 30 2008 - 11:45:23 CDT

Original text of this message