How to find next week Day for scheduling problem

Hi Team ,
Can you guide me on the below problem
I have a table, and the table has three columns. Based on the column “Info Tech” and the value contained in the column, I will get the day.

For Eg:

Info Tech contains “IT AI ML” = “Tuesday”

Then I need to find out the next Tuesday date if the current date is not Tuesday.

In Short its a scheduling logic , can you please suggest me

day.xlsx (9.3 KB)

@JSR_Techno_Talk_s

First check if now.dayofweek is tuesday

If not use now.adddays(9-now.dayofweek) this willbethe next tuesday

Cheers

Problem is that next day depends on table column value selection,

It can be any day,

@JSR_Techno_Talk_s

Then use like this

First check Cint(Now.DayOfWeek) = Array.FindIndex(CultureInfo.CurrentCulture.DateTimeFormat.DayNames, function(x) x.ToString.Equals("Requiredday")) 

On else side use Now.Adddays(7+ Array.FindIndex(CultureInfo.CurrentCulture.DateTimeFormat.DayNames, function(x) x.ToString.Equals("Requiredday")) - Cint(Now.DayOfWeek))

Cheers

let me try this one

Sorry its not working
Test case , My post should be schedule on upcoming Wednesday , and its on 28th

@JSR_Techno_Talk_s

Update

Now.Adddays(If(Array.FindIndex(CultureInfo.CurrentCulture.DateTimeFormat.DayNames, function(x) x.ToString.Equals("Wednesday")) - Cint(Now.DayOfWeek)<=0,7,0) + Array.FindIndex(CultureInfo.CurrentCulture.DateTimeFormat.DayNames, function(x) x.ToString.Equals("Wednesday")) - Cint(Now.DayOfWeek))

cheers

Really Thanks, Anil_G

One more solution i got

Do
{
CurrentDate.AddDays(1)
CDate(CurrentDate).DayOfWeek.ToString.ToLower

}
While (currentDate <> Find Day)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.