How to check if Sunday is present

Hii Team,

Depending on today’s date
How can we check if Sunday has passed

Example
1.Check in First 7 days of Month

**If Today is 2nd May **
**Then **
Log msg(“Sunday is Not Present in Week Passed”)

Else If
Today’s date is 5th June
**Then **
Log Msg (“Sunday is Present in Week Passed”)
It should check before dates if Sunday is Present i.e 1 to 4th June if it contains Sunday

Thanks Team in Advance

@NISHITHA

  1. Get Today’s Date: Use an Assign activity to set a variable todayDate to DateTime.Now.
  2. Extract Day of Week for Today’s Date: Use another Assign activity to set a variable dayOfWeek to todayDate.DayOfWeek.
  3. Check if Sunday Has Passed within First 7 Days: Use a Decision activity with the following condition:
todayDate.Day <= 7 AndAlso dayOfWeek = DayOfWeek.Sunday
  1. Log Message Based on Condition:
  • If the condition is True, use a Log Message activity to output "Sunday is Present in Week Passed".
  • If the condition is False, use a Log Message activity to output "Sunday is Not Present in Week Passed".

Hi @NISHITHA

Your query is quite confusing could you specify more inputs.

Hi @NISHITHA

could you please try this vb.net code in invoke code activity.

Imports System

Public Class Main
Public Shared Sub Main()
Dim today As DateTime = DateTime.Now
Dim sunday As DateTime = today.AddDays(-(today.DayOfWeek - DayOfWeek.Sunday))

    If today.DayOfWeek < DayOfWeek.Sunday Then
        Console.WriteLine("Sunday has not passed in the week.")
    Else
        Console.WriteLine("Sunday has passed in the week.")
    End If
End Sub

End Class

hope it helps!!!