We consider saturdy, and sunday is holiday..
so when I add +10 with current date, It should show me the date excluding Saturday, sunday,
for example If I input as (5/25/2016)+ 10 then result should be 6/8/2016
Is it make sense ?
Will something like this help:
Calculating a Finish Date Given a Starting Date and the Number of Work Days | FileMaker
Let ( [
targetDate = Get ( CurrentDate ) + x ;
dow = DayOfWeek ( targetDate ) ;
shift = Case ( dow = 7 ; 2 ; dow = 1 ; 1 )
targetDate + shift
dgurusamy wrote:If I input as (5/25/2016)+ 10 then result should be 6/8/2016
If I input as (5/25/2016)+ 10 then result should be 6/8/2016
No, it's 6/6/2016
A couple of alternatives that calculate it as 8th June 2016
Let ( [
startDate = getasdate( "25/5/2016" ) ;
days = 10 ;
day = If ( DayOfWeek ( startDate ) = 1 ; 7 ; DayOfWeek ( startDate ) - 1 )
startDate + days + If ( day = 6 ; 2 ; 0 ) +
( Floor ( ( days -1 + ( If ( day = 6 ; 1 ; Mod ( day ; 6 )^1 ) ) ) /5 ) *2 )
Let ([ StartDate = GetAsDate("25/05/2016") ;
WorkDays = 10 ]
StartDate + Int ( WorkDays / 5 ) * 7 + Middle ( "12345012340123601256014560345623456" ; ( DayOfWeek ( StartDate ) - 1 ) * 5 + Mod ( WorkDays ; 5 ) + 1 ; 1 )
erolst wrote: No, it's 6/6/2016
It seems you're only shifting once for a weekend, but if there are multiple weekends in the dates between the number of workdays that need to be added on, it will calculate incorrectly.
So this is to be understood as someDate + x workdays?
Well, I see you already have some alternatives.
Retrieving data ...