# ODK Central API - Dates comparison seems to not working properly

**URL:** <https://forum.getodk.org/t/odk-central-api-dates-comparison-seems-to-not-working-properly/38900>\
**Category:** Support\
**Tags:** odk-central\
**Created:** [September 7, 2022, 1:57pm UTC](https://forum.getodk.org/t/odk-central-api-dates-comparison-seems-to-not-working-properly/38900 "2022-09-07T13:57:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/j/71e660/32.png) [@Julien](https://forum.getodk.org/u/Julien)\
**Post date:** [September 7, 2022, 1:57pm UTC](https://forum.getodk.org/t/odk-central-api-dates-comparison-seems-to-not-working-properly/38900/1 "2022-09-07T13:57:32Z")

</div>

**1. What is the issue? Please be detailed.**

I tried to import in MongoDB, a csv file received from ODK Central with the help of ODK Central API.  
As I do not want to create a bunch of duplicate in my database, I tried to send a filtered request based on date comparaison.  
The request sent, with Python, looks like that:

```auto
download = requests.get(central_url + "/v1/projects/6/forms/" + subname + "/submissions.csv.zip?$filter=__system/submissionDate gt {}".format(last_submission_final), auth=(central_email, central_password))

```

which is received by ODK Central:

```auto
https://server/v1/projects/6/forms/collection/submissions.csv.zip?$filter=__system/submissionDate%20gt%202022-09-06T16:07:01.589000Z

```

I have exactly the same date in both ODK Central and the Mongo database:  
2022-09-06T16:07:01.589000Z  
I thought that the filter operator "gt" would skip to import the mongo document with the same date. But it seems not.  
I always received a \*.csv file with a line includind the date above.  
It seems that the "gt" operators behave the same way that the "ge" one.

**2. What steps can we take to reproduce this issue?**

**3. What have you tried to fix the issue?**  
For know, I will try to add a minute to the time sent. If it happens that the "lt" operator is responsible in my script issue.

**4. Upload any test forms or screenshots below.**

Does anyone encounter this kind of issue ?

---

<div class="post-metadata">

**Author:** ![Sadiq\_Khoja](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/sadiq_khoja/32/3719_2.png) [@Sadiq\_Khoja](https://forum.getodk.org/u/Sadiq_Khoja)\
**Post date:** [September 12, 2022, 5:16pm UTC](https://forum.getodk.org/t/odk-central-api-dates-comparison-seems-to-not-working-properly/38900/2 "2022-09-12T17:16:47Z")

</div>

It is a known issue, and there is a discussion going on to fix this.

Ref: [https://github.com/getodk/central-backend/issues/459](https://github.com/getodk/central-backend/issues/459)

---

<div class="post-metadata">

**Author:** ![Julien](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/j/71e660/32.png) [@Julien](https://forum.getodk.org/u/Julien)\
**Post date:** [September 13, 2022, 7:33am UTC](https://forum.getodk.org/t/odk-central-api-dates-comparison-seems-to-not-working-properly/38900/3 "2022-09-13T07:33:26Z")

</div>

Thanks for the reply. And apologizes for this useless topic ... I should have read more carefully the ongoing issue.  
For now, I still use this kind of workaround:  
`last_submission_timeshift = last_submission_ugly + timedelta (seconds=10)`
