How can I use greater than and less than operator with date values?

Highlighted
Anonymous
Not applicable

How can I use greater than and less than operator with date values?

I want to render dynamic content for leads with the anniversary date between 7-1-16 and 10-30-16 and I've scripted the following but it's not working? Any ideas on how I can make this work? Can I use a date values stored in custom object to drive content logic using if and else statement?

#foreach($partner in $partner_cList)
#set ($AnniversaryDate = $date.toDate("yyyy-MM-dd", ${partner.AnniversaryDate}))

#set ($Date1 = "2016-7-1")
#set ($Date2 = "2016-10-30")


#if($Date1 <= $AnniversaryDate && $Date2 >= $AnniversaryDate)
#set($matchedpartner = ${partner.partnerID})


#else
#end
#end

3 REPLIES 3
Highlighted
Level 8

Re: How can I use greater than and less than operator with date values?

Wouldn't it be less work to just create two emails?

Highlighted
Anonymous
Not applicable

Re: How can I use greater than and less than operator with date values?

I don't think you need scripting for this anyway.

Just use two filters in a normal smartlist

Anniversary date is after x

Anniversary date is before y

Highlighted
Anonymous
Not applicable

Re: How can I use greater than and less than operator with date values?

Thanks for the suggestions! I know that if I build it as separate emails using smartlist to filter it, it would work for the scenario above but what I'm asking is just one part of the content. It has multiple dynamic content with several conditions so if built as static emails there would be too many versions and that's what I'm trying to avoid.