Contributions
Re: How to calculate the Businessday and skip the holidays in vbscript
Kindly check updated reply for your question: Here is the sample code: Select Case Weekday(DateToVerify) Case "7" Log.Message "Date falls on Saturday.. Continue Test" :VerifyIfDateFallsOnWeekend="SATURDAY" Case "1" log.Message "Drade date falls on Sunday.. Continue Test" :VerifyIfDateFallsOnWeekend="SUNDAY" Case Else Log.Checkpoint "Date falls on weekdays. Date is : "&DateToVerify :VerifyIfDateFallsOnWeekend="WEEKDAY" End Select3.4KViews0likes0CommentsRe: How to calculate the Businessday and skip the holidays in vbscript
If you are looking for whether the date falls on weekend then, there is a inbuiltfunction called'Weekday' in VBScript to check if the date falls on weekend or not. If the date falls on weekend or on aholiday then use DateAdd Function as specified below. Here is the sample code: Select Case Weekday(DateToVerify) Case "7" Log.Message "Date falls on Saturday.. Continue Test" :VerifyIfDateFallsOnWeekend="SATURDAY" Case "1" log.Message "Drade date falls on Sunday.. Continue Test" :VerifyIfDateFallsOnWeekend="SUNDAY" Case Else Log.Checkpoint "Date falls on weekdays. Date is :&DateToVerify :VerifyIfDateFallsOnWeekend="WEEKDAY" End Select DateAdd Function: If (IsWeekday = "SATURDAY") then Date = DateAdd("d",2,NextDate) If you want to verify if the date is a public holiday, then you will have to create holiday database or map to lookup, since public holidays varies from country to country every year, you should use App holiday data for your date processing.3.4KViews0likes3CommentsRe: How to calculate the Businessday and skip the holidays in vbscript
If you are looking for whether the date falls on weekend then, there is a inbuiltfunction 'Weekday' in VBScript to check if the date falls on weekend or not. If you want to verify if the date is a public holiday then you will have to create holiday database or map for lookup. For the most of the applications holiday calendar is stored somewhere you can access that and use it for lookup. Here is the sample code: Select Case Weekday(DateToVerify) Case "7" Log.Message "Date falls on Saturday.. Continue Test" :VerifyIfDateFallsOnWeekend="SATURDAY" Case "1" log.Message "Drade date falls on Sunday.. Continue Test" :VerifyIfDateFallsOnWeekend="SUNDAY" Case Else Log.Checkpoint "Date falls on weekdays. Date is : "&DateToVerify :VerifyIfDateFallsOnWeekend="WEEKDAY" End Select3.4KViews0likes0Comments