Determine current week or next week based on given date

Hi All,

I’m looking to determine the given date falls under current week or next week.
Could you please help me to get this.
Ex:-

  1. Input - 09/25/2019 O/P - Current week
  2. I/P - 10/01/2019 ; o/p - Next week.
  3. I/P - 09/23/2019; O/P- Current week.

Thanks in advance…

Best Regards,
Pradeep

@pradeepkintali

  1. First find the current week dates.

  2. Then check input date is fall under current week dates. If yes then output will be current week else it will be next week.

First try something withe steps and of you face any issues then let us know and we all are ready to help you.

@lakshman,

Thanks for information…

I’m able to get dates between two dates and written vb code to get the current week date from Current_Monday = Date - Weekday(Date, vbMonday) + 1

i thought to work in same way as you suggested but not able to get the current week dates based on single date in UIPath.

can you give some insghts how to get current week dates in UIPath. so that i will try to implement.

Thanks in advance…

1 Like

Use Invoke Code with following code, give inputDate as input Arg, and output as out arg in invoke code activity

Dim dayOfWeek As Integer
dayOfWeek= CInt(DateTime.Today.DayOfWeek)
Dim startOfWeek As String
startOfWeek = DateTime.Today.AddDays(-1*dayOfWeek).ToString(“MM/dd/yyyy”)
Dim days As Integer = CInt(DateDiff(DateInterval.Day,CDate(startOfWeek),CDate(inputDate)))
If(days>6) Then
output = “Next Week”
Else If(days>=0 And days<7) Then
output = “Current Week”
Else
output = “Previous Week”
End If

2 Likes

@akgurram - Thank you, It is working perfectly.

1 Like

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