PL/SQL (MOSC)

MOSC Banner

Issue in calculating hours between two dates .. excluding weekends

edited Sep 18, 2014 5:03AM in PL/SQL (MOSC) 3 commentsAnswered

Using the select statement below I'm getting varying results which don't seem to make sense. I have 4 dates that I'm working with where I subtract one date from another and come up with the number of hours that elapsed, excluding weekends.

select doc_seq seqno, to_char(rcvd_dt,'mm/dd/yyyy hh24:mm:ss') rcvdt,

                                  to_char(scnd_dt,'mm/dd/yyyy hh24:mm:ss') scndt,

                                  to_char(post_dt,'mm/dd/yyyy hh24:mm:ss') ldt,

                                  to_char(vrfd_dt,'mm/dd/yyyy hh24:mm:ss') vdt,

((scnd_dt - rcvd_dt)*24) - (((((TRUNC(scnd_dt,'D'))-(TRUNC(rcvd_dt,'D')))/7)*2)*24) r2s,

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center