Check week In Between of a month

Hello Everyone,

How can we check based of present date if week is between of a month

Example
If date is Not first week of a month Or last week of Month

Then Print Log message as True(Week in Between)

Hi @anmita

Try this:

Sequence
Assign: currentDate = DateTime.Now
 If (Condition: currentDate.Day > 7 And currentDate.Day <= DateTime.DaysInMonth(currentDate.Year, currentDate.Month) - 7)
Then
    Log Message: "True (Week in Between)"
Else
    Log Message: "False (First or Last Week)"

Hope it helps!!

Thanks @Parvathy for the quick response

1 Like

@anmita

Boolean variable isWeekInBetween

isWeekInBetween=DateTime.Now.Day > 7 And DateTime.Now.Day <= (DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month) - 7)

Hello @anmita

Sequence

Assign Name="isInFirstWeek" Value="[Your Condition for First Week]"
Assign Name="isInLastWeek" Value="[Your Condition for Last Week]"
If Condition="Not isInFirstWeek And Not isInLastWeek"
    LogMessage Text="True (Week in Between)" 

Replace [Your Condition for First Week] and [Your Condition for Last Week] with the actual conditions to check if the current date is in the first or last week of the month. If neither condition is met, the log message “True (Week in Between)” will be printed.

Thanks & Cheers!!!

Hi @anmita

if(Now.day >7 AndAlso Now.Day<=DateTime.DaysInMonth(Now.Year, Now.Month) - 7,“T”,“F”)

Try this

Hi @anmita ,

Could also maybe check with the below :

Now.Day>7 andAlso Now.Day<Now.AddDays(-Now.day).AddMonths(1).Day-7

image