Year related

Hi all,
My doubt is I need to check if it is 1st Jan and give a condition like if 1st Jan then click date as 31st December and year previous year.
How to check this and give condition.

Please help me, thanks in advance

If Now.Day = 1 and Now.Month = 1

  • Assign myDate = DateAdd(DateInterval.Day,-1,Now)

So if today is first day of first month, it assigns mydate to the previous date.

@hanviprebday

What is your complete date format?

If you have the date then date.Adddays(-1) will take care of everything together

Cheers

1 Like

You can do it like this:
1 - If activity → strDate.Day = 1 and strDate.Month = 1
2 - Then branch → strDate = strDate.AddDays(-1)
3 - Else branch → nothing

Note: strDate as to be defined as “Now”.

Hi @hanviprebday

Try this

  • Assign
    • To: currentDate
    • Value: Now
  • If
    • Condition: currentDate.Month = 1 And currentDate.Day = 1
    • Assign
      • To: previousYear
      • Value: currentDate.Year - 1
    • Assign
      • To: targetDate
      • Value: New DateTime(previousYear, 12, 31)

I hope it helps!!