I have a requirement where I need to work on a date field, so the requirement is some thing like this
I will call the field as minimum possible date
I had similar requirement in my project , and i retrieved by using SQl Server. If you can do in SQL server , we have very simple query which returns the next business day.
DECLARE @dt datetime='20150113'
SELECT DATEADD(dd,CASE WHEN DATEDIFF(dd,0,@dt)%7 > 3 THEN 7-DATEDIFF(dd,0,@dt)%7 ELSE 1 END,@dt)
Explanation :
Always base date is '1900 jan 1 st ' As per DB
19000101 --> Monday --> -- So result is THEN VALUE =1 day
19000102 --> Tuesday --> -- So result is THEN VALUE =1 day
19000103 --> Wednesday --> -- So result is THEN VALUE =1 day
19000104 --> Thursday --> -- So result is THEN VALUE =1 day
19000105 --> Friday --> -- So result is 7-@number = 3 days
19000106 --> Saturday --> -- So result is 7-@number =2 days
19000107 --> Sunday --> -- So result is 7-@number =1 day