Getting a specific day of week help

Hello,

I was wondering if one of you kind people could help me figure this out… So basically I am trying to figure out the time between a string (MM/dd/yyyy HH:mm:ss) and a date which is two Tuesdays from that date… Sounds confusing but let me try and break it down a bit. Suppose I have two dates, the date I received the email lets call it A and I need to find date B which is the second Tuesday from date A.

As an example suppose date A is 10/03/2019 08:00:00 I need to find two Tuesdays from that in this case it would be 10/15/2019.

Is there any way to achieve this?

Thanks a lot!

Hi @rileythiessen

Try this. Just substitute your original date.

If Weekday(origDate) < 3 Then
    DateAdd(DateInterval.Day, 10 - Weekday(origDate), origDate)
Else
    DateAdd(DateInterval.Day, 17 - Weekday(origDate), origDate)
End If

Cheers

Troy

Appreciate the quick reply! Also are you just calling this with an ‘Invoke Code’ activity and passing in/out the date variable?

You could either do that way or an IF activity with an Invoke Method (for the DateAdd). Either way you’re going to have to add a target date variable.

Yeah I didn’t really think about the actual implementation. Sorry 'bout that.

All good! Appreciate the help. I actually ended up implementing it in a simple if activity.
Did a if:
Weekday(var) < 3
Then: Using assign activity used your method
Same thing for the else!

Thanks again!

Glad to help!

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