Variable Help SetUp - NEED HELP ASAP!


I am working with data by quarter. I created a variable called “Month” that gets the current month.( now.Month.ToString)

Next I have four If activities with following conditions:

Month <= “3” Does NOT Work
Month > “3” and Month < “7” Does NOT Work
Month > “6” and Month < “10” Does NOT Work
Month > “9” Does NOT Work

Please tell me if I’m going wrong with the two middle month set ups. Thanks!!!

Hi @Geek,

Set the variable Month as an integer and try the following code:
Month = Integer.Parse(DateTime.Now.Month.ToString("00"))

Then do the comparison like this:
Month > 3 And Month < 7

1 Like

That worked, thank you much!!!

1 Like


You can also use the below to extract parts of the date.

Month(Now).ToString or Year(Now).ToString

That should also return an integer. So for conditions it’s like Month(Now) < 3
If you want it zero-filled, then do Month(Now).ToString(“00”)

If you have a DateTime variable, you can set its Default to Now, then use the variable like…
Month(timeToday) or Month(timeToday).ToString
That’s how I do it.


1 Like

Oh, I also wanted to add that I’m pretty sure you can compare DateTimes in the condition.
So for example, you have a dateTime variable set…
Q2 = CDate(“03/01/2017”)

Then, you can use that in a condition
Now < Q2

This method will incorporate the time and year with the date too so might be more sustainable.
Of course, there are probably multiple solutions for what you need.


1 Like

Thank you, Clayton! I appreciate the prompt response.