on 08-25-2015 10:30 AM
Hi Friends,
Can please let me know, how to exclude the weekends from date value. Please find the my logic below.
If Header.Flag = 'Y' and Header.CheckInDate is blank,then 12/31/2020
If Header.Flag = 'Y' and Header.CheckInDate is not blank, then Header.CheckInDate - 3 working days (exclude weekends)
If Header.Flag <>'Y'then Current Date + 21 business days
Thanks & Regards,
Balamurugan G
Hi Bala,
I hope this would help you.
For case 2:
If Header.Flag = 'Y' and Header.CheckInDate is not blank, then Header.CheckInDate - 3 working days (exclude weekends)
Solution:-decode(day_in_week(Header.CheckInDate)<=3,Header.CheckInDate-5,Header.CheckInDate-3)
For Case 3:
If Header.Flag <>'Y'then Current Date + 21 business days
Solution:-decode(day_in_week(Current Date+21+8)=6,Current Date+31,day_in_week(Current Date+21+8)=7,Current Date+30,Current Date+29)
Regards,
Sandeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sandeep,
Thanks a lot for your help. Your solution is helped me to find the working days excluding weekends. I made small correction in your code and it works perfectly.
Please find the correct code below:
For case 2:
decode(day_in_week(Q_Join.CheckInDate)<=3, Q_Join.CheckInDate-5,
day_in_week(Q_Join.CheckInDate)=7, Q_Join.CheckInDate-4,
Q_Join.CheckInDate-3)
For case 3:
decode(day_in_week(Q_Join.SysDate)=5, Q_Join.SysDate+31,
day_in_week(Q_Join.SysDate)=6, Q_Join.SysDate+30,
Q_Join.SysDate+29)
Thanks & Regards,
Balamurugan G
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.