Skip to main content
June 15, 2016
Question

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

  • June 15, 2016
  • 2 replies
  • 1411 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Robb_Barrett
Level 10
June 15, 2016

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

Robb Barrett
June 15, 2016

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

June 17, 2016

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.