question

Upvotes
Accepted
3 0 0 2

DateTimeOffset not implemented for ReportExtractionOperations.GetCompletedByDateRange()

I am writing C# code using the REST API SDK to download extractions that have completed in the last hour.

The code I was using was:

var completedExtractions = extractionsContext.ReportExtractionOperations.GetCompletedByDateRange(
startDate: DateTimeOffset.Now.AddMinutes(lookBackMinutes * -1),
endDate: DateTimeOffset.Now);

This code does not work for my time-zone (currently UTC+1:00). In order to get it to work I had to change DateTimeOffset.Now to DateTimeOffset.UtcNow. It appears that the time-zone info in the DateTimeOffset values is being ignored.

Is this my mistake or is the API incorrectly handling DateTimeOffset values?

tick-history-rest-apirest-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
11.3k 25 8 13

Hi @dwinson,

I have found the same result. According to description of startDate and endDate in the REST API metadata, I understand the GetCompletedByDateRange endpoint supports only UTC date and time, so the function only works with the DateTimeOffset.UtcNow.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea