5

I have contacted Exact Target support for this but they sent me here. I can't seem to get results back from the API that match my date time filters. I think they are telling me that my DateTime needs to be serialized to look something like this for CST: 2014-07-22T00:00:00.000-06:00 but I can't figure out how to get this to happen.

If my request XML looks like this:

        <Filter xsi:type="ComplexFilterPart">
           <LeftOperand xsi:type="SimpleFilterPart">
              <Property>CurrentStatus</Property>
              <SimpleOperator>equals</SimpleOperator>
              <Value>Held</Value>
           </LeftOperand>
           <LogicalOperator>AND</LogicalOperator>
           <RightOperand xsi:type="SimpleFilterPart">
              <Property>CreatedDate</Property>
              <SimpleOperator>greaterThan</SimpleOperator>
              <DateValue>2014-07-25T04:52:22.674964</DateValue>
           </RightOperand>
        </Filter>

I get results which are lower than the DateTime provided in the filter such as:

<CreatedDate>2014-07-24T23:25:40.46</CreatedDate> 

I tried converting to the timezone they have asked for and have tried playing around using different DateTimeKinds but have had no luck with anything. For example:

        TimeZoneInfo centralZone = TimeZoneInfo.CreateCustomTimeZone("CST No Daylight Savings", TimeSpan.FromHours(-6), "CST No Daylight Savings", "CST No Daylight Savings");

        lastHardBounceDate = TimeZoneInfo.ConvertTime(DateTime.Now.AddHours(-1), centralZone);

Does anyone have any information for how to resolve this?

3
  • What time zone is your account on?
    – Timothy
    Commented Jul 25, 2014 at 16:39
  • They say the server is on CST no daylight savings. It should be -6 at all times basically.
    – Wiredness
    Commented Jul 28, 2014 at 8:59
  • Apparently my account is set to GMT
    – Wiredness
    Commented Jul 28, 2014 at 15:38

4 Answers 4

1

So i know they tell you not to, but have you tried using the string value on the filter?

r.Filter = new SimpleFilterPart{
        Property = "CreatedDate",
        SimpleOperator = SimpleOperators.greaterThan,
        Value = new []{"2014-01-14 00:00:00"}
    };

The above works as expected for me with no need to add any timezone information.

0

Unfortunately, I don't know much about C#. But since the question is 3 days old and nobody else seems to step forward, maybe I can help a little:

Possibly, your problem is not with the request but with the response (or maybe no problem at all once you know how to read the response).

It seems that the DateValue you supply in your request is interpreted to use the timezone configured in your account (maybe Central European Time?). In contrast, the timestamp that is returned in the response is in the CST time zone.

In the example above, you ask the server "please give me everything that was created after 4:52 (in Europe)" and the server replies: "Here... this thing was created at 23:25" (in the US).

That seems a little inconsistent, but basically, I think the item(s) returned by the server are the items you requested. Maybe you can adjust or configure the response parser to correctly interpret the data returned from the server...

Hope this helps at least a little bit...

1
  • and I wrote this before you said that your account is GMT. That doesn't sound right, because I think nobody is actually on GMT right now (except maybe some part of the Ocean or maybe some part of Africa). I think you can configure the timezone for your account yourself. I know I can (Account > Administration > Account settings), but I don't know if this depends on permissions... setting it to the correct timezone might make it behave the way you want it to...
    – Finch
    Commented Jul 28, 2014 at 16:50
0

Should it not be a matter of converting your timestamp prior to passing it via API call? See if following pages would help: http://msdn.microsoft.com/en-us/library/system.timezoneinfo.converttimefromutc(v=vs.110).aspx and http://msdn.microsoft.com/en-us/library/bb397769(v=vs.110).aspx.

As soon as you've got CST value in C then you simply pass it as an API payload and will definitely get the right results.

3
  • Hi - no that doesn't seem to work. The code in the original question was used to convert to a different timezone but it doesn't output as they want it to which is like this: 2014-07-22T00:00:00.000-06:00
    – Wiredness
    Commented Aug 4, 2014 at 10:18
  • Gotcha, then the following URL should help as you are purely asking about the formatting of the value: msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx Just one step further from that page will take you here: msdn.microsoft.com/en-us/library/…
    – Vlad
    Commented Aug 4, 2014 at 12:22
  • But the SOAP API they have provided me with just takes a DateTime so there isn't really a way for me to format it.
    – Wiredness
    Commented Aug 4, 2014 at 12:43
0

I'm not allowed to add comments (which is really stupid, comments are more useful than answers quite often), so I have to "comment" here, it's not really meant as an answer. Sorry about that, it's StackExchange's fault:

Can you be more specific about what you're trying to achieve? From your question, we don't know which information you want to get from the server. You're currently sending

<DateValue>2014-07-25T04:52:22.674964</DateValue>

in your request. Once you get formattting to CST working, this would be

<DateValue>2014-07-24T21:52:22.674964-06:00</DateValue>

... and the response from the server would be exactly the same as it is now.

At what time was this request sent? If it was sent at 5:52 in your timezone and if you're trying to get the hard bounces that happened in the last hour (just guessing), this request is ok and you just need to interpret the result appropriately.

Alternatively, you could send

<DateValue>2014-07-25T04:52:22.674964-06:00</DateValue>

which would probably return no result ever (still assuming this was sent at 5:52 in your timezone after subtracting an hour from current time).

Maybe we can help you more if you tell us an example: what time is the request sent and what is it supposed to look like? Maybe it's easier and faster to try this in SOAP-UI first before worrying about formatting in the API (btw: I did try something in SOAP-UI before posting my first answer and it's what led me to the conclusions I have shared).

Hope that helps...

1
  • If I send <DateValue>2014-07-25T04:52:22.674964</DateValue> that time is being converted by the server to some other time. I can't be sure how it is converting it or what timezone it thinks that is. It also could change it's behaviour in future. If I specify <DateValue>2014-07-24T21:52:22.674964-06:00</DateValue> then I know exactly what timezone it is being interpreted as. I want to get all hard bounces - so if I have a datetime back from the server I want to ask it for all hard bounces since the last datetime I have received. To do that I really need to be able to set the timezone.
    – Wiredness
    Commented Aug 5, 2014 at 10:43

You must log in to answer this question.

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