I'm currently using the Java bindings of the Partner API to extract unsubs, clicks, bounces and other events. This is working as expected, however I'd like to slice my requests by a date range (similar to this).

I'm trying to replicate the following logic (Ignore the fact that I've used SQL as pseudo-code) in my request such that I'm able to dynamically slice my requests using two input parameters (xxx, yyy): Select * from Unsubs Where EventDate > xxx and EventDate < yyy

I'm currently using two SimpleFilterPart's combined in a ComplexFilter part to achieve this filtering logic. As below:

// Init Request data
RetrieveRequestMsgDocument retrieveRequestMsgDocument = RetrieveRequestMsgDocument.Factory
RetrieveRequest rreq = RetrieveRequest.Factory.newInstance();

// Other stuff removed from this extract ....

// Setup filter 1
SimpleFilterPart filter1 = SimpleFilterPart.Factory.newInstance();
filter1.setDateValue1Array(new GregorianCalendar[] { (GregorianCalendar) startDate });

// Setup filter 2
SimpleFilterPart filter2 = SimpleFilterPart.Factory.newInstance();
filter2.setDateValue1Array(new GregorianCalendar[] { (GregorianCalendar) endDate });

// Combine filters
ComplexFilterPart cfp1 = ComplexFilterPart.Factory.newInstance();

RetrieveRequestMsgDocument.RetrieveRequestMsg retrieveRequestMsg = retrieveRequestMsgDocument

Ultimately the Java builds the following SOAP extract:

 <xml-fragment xmlns:par="http://exacttarget.com/wsdl/partnerAPI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    Stuff omitted
  <par:Filter xsi:type="par:ComplexFilterPart">
    <par:LeftOperand xsi:type="par:SimpleFilterPart">
    <par:RightOperand xsi:type="par:SimpleFilterPart">

In the above example I’m attempting to extract Unsubs between 07/01/2015 and 08/01/2015 (UK date format).

My question - is this the correct way to filter requests by date? I'm seeing data from 06/01 and 07/01 returned from this request which implies my lower bound isn't working correctly. Am I fundimentally builing my requests incorrectly or is there some date normalization need to perform?

  • 1
    Are you doing some sort of timezone conversion after the results are returned? ET web services always works on ET server time (-6 GMT CST, no daylight savings observed)
    – mobo
    Jan 9, 2015 at 17:22
  • Nope, I'm creating a SimpleDateFormat and just dumping the string to the console for debugging. I thought ET WS were based on UTC? Jan 12, 2015 at 12:13

1 Answer 1


Here are a couple of date formats I've used with success in filtering by date:

<RightOperand xsi:type="SimpleFilterPart">

<RightOperand xsi:type="SimpleFilterPart">

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .